diff --git a/.github/workflows/ante-benchmark.yml b/.github/workflows/ante-benchmark.yml index 54036daa5..aa40533ba 100644 --- a/.github/workflows/ante-benchmark.yml +++ b/.github/workflows/ante-benchmark.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v4 with: - go-version: '1.21.9' + go-version: '1.21.11' check-latest: true - name: Run benchmark tests diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c3dfb697..eaa39e5e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: '1.21.9' + go-version: '1.21.11' check-latest: true - uses: technote-space/get-diff-action@v6.1.2 id: git_diff diff --git a/.github/workflows/consensuswarn.yml b/.github/workflows/consensuswarn.yml index b7d860760..868e30b4e 100644 --- a/.github/workflows/consensuswarn.yml +++ b/.github/workflows/consensuswarn.yml @@ -17,6 +17,8 @@ jobs: contents: read pull-requests: write # For reading the PR and posting comment runs-on: ubuntu-latest + env: + GOTOOLCHAIN: "go1.21.11" steps: # This is used for warning when a PR touches any of the roots, or any function or method directly or indirectly called by a root - uses: actions/checkout@v4 diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 1e846db7c..5c613edab 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.21.9' + go-version: '1.21.11' check-latest: true - name: "Checkout Repository" uses: actions/checkout@v4 diff --git a/.github/workflows/docker-localnet.yml b/.github/workflows/docker-localnet.yml new file mode 100644 index 000000000..b4e82e365 --- /dev/null +++ b/.github/workflows/docker-localnet.yml @@ -0,0 +1,32 @@ +name: Docker build for localnet +on: + pull_request: + paths: + - networks/local/exocore/Dockerfile + - networks/Makefile + push: + paths: + - networks/local/exocore/Dockerfile + - networks/Makefile + branches: + - develop + - main + - master + - release/** + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + run: make -C ./networks diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..9ed7fc649 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,30 @@ +name: Docker build in root directory +on: + pull_request: + paths: + - Dockerfile + push: + paths: + - Dockerfile + branches: + - develop + - main + - master + - release/** + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + run: docker build . diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 5af5399b7..a63dc9014 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -1,35 +1,38 @@ name: goreleaser permissions: - # github releases contents: write on: push: tags: - "v*.*.*" -env: - CGO_CFLAGS: "-O -D__BLST_PORTABLE__" - CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__" + # Validate on develop, main, and master branches that the releaser + # is working as expected. + pull_request: + branches: + - develop + - main + - master + jobs: goreleaser: runs-on: ubuntu-latest - environment: release steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 with: submodules: true - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21.9' + go-version: '1.21.11' check-latest: true - - name: release dry run + - name: Release dry run run: make release-dry-run - - name: setup release environment + - name: Release publish + # Do not publish the release for pull requests. + if: github.event_name != 'pull_request' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: |- - echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env - - name: release publish run: make release diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9c9154031..ed0476abd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,7 +21,7 @@ jobs: # Required: setup-go, for all versions v3.0.0+ of golangci-lint - uses: actions/setup-go@v5 with: - go-version: '1.21.9' + go-version: '1.21.11' # Use pinned versions, not git versions check-latest: false # Match `golangci-lint-action` recommendation diff --git a/.github/workflows/proto-comment.yml b/.github/workflows/proto-comment.yml index 596243c10..8c727c076 100644 --- a/.github/workflows/proto-comment.yml +++ b/.github/workflows/proto-comment.yml @@ -17,8 +17,7 @@ on: jobs: download-artifact-and-comment: runs-on: ubuntu-latest - if: > - github.event.workflow_run.conclusion == 'success' + if: ${{ false }} steps: - name: 'Download artifact' uses: actions/github-script@v7.0.1 diff --git a/.github/workflows/test-comment.yml b/.github/workflows/test-comment.yml index 9fc63ddca..eac81ec3f 100644 --- a/.github/workflows/test-comment.yml +++ b/.github/workflows/test-comment.yml @@ -18,9 +18,7 @@ on: jobs: download-artifact-and-comment: runs-on: ubuntu-latest - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' + if: ${{ false }} steps: - name: Download artifact uses: actions/github-script@v7.0.1 diff --git a/.golangci.yml b/.golangci.yml index f82371276..b31d2cb00 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,6 +2,7 @@ run: tests: false timeout: 5m concurrency: 4 + go: "1.21.11" linters: enable: @@ -49,8 +50,6 @@ linters-settings: allow-leading-space: true require-explanation: false require-specific: false - gofumpt: - lang-version: "1.21.9" gomodguard: blocked: versions: # List of blocked module version constraints diff --git a/.goreleaser.yml b/.goreleaser.yml index d63ceab6b..bddc88dfe 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,3 +1,5 @@ +version: 2 + before: hooks: - go mod download @@ -101,4 +103,4 @@ changelog: - '^docs:' - '^test:' snapshot: - name_template: "{{ .Tag }}-next" + name_template: "{{ .Tag }}-{{ .Branch }}@{{ .ShortCommit }}-{{ .GitTreeState }}" diff --git a/.protolint.yml b/.protolint.yml index 6d6ebf7de..717affd18 100644 --- a/.protolint.yml +++ b/.protolint.yml @@ -129,8 +129,9 @@ lint: - For - Of # # The specific keywords including prepositions to ignore. E.g. EndOfSupport is a term you would like to use, and skip checking. - # excludes: - # - EndOfSupport + excludes: + - OptOutOfAVSReq + - OptOutOfAVSResponse # # RPC_NAMES_CASE rule option. # rpc_names_case: diff --git a/Dockerfile b/Dockerfile index 4a64abccc..e07e0d824 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ # This is the published docker image for exocore. -FROM golang:1.21.9-alpine3.18 AS build-env +FROM golang:1.21.11-alpine3.19 AS build-env WORKDIR /go/src/github.com/ExocoreNetwork/exocore COPY go.mod go.sum ./ -RUN apk add --no-cache ca-certificates=20230506-r0 build-base=0.5-r3 git=2.40.1-r0 linux-headers=6.3-r0 +RUN apk add --no-cache ca-certificates=20240226-r0 build-base=0.5-r3 git=2.43.4-r0 linux-headers=6.5-r0 RUN --mount=type=bind,target=. --mount=type=secret,id=GITHUB_TOKEN \ git config --global url."https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/".insteadOf "https://github.com/"; \ @@ -16,14 +16,14 @@ COPY . . RUN make build && go install github.com/MinseokOh/toml-cli@latest -FROM alpine:3.18 +FROM alpine:3.19 WORKDIR /root COPY --from=build-env /go/src/github.com/ExocoreNetwork/exocore/build/exocored /usr/bin/exocored COPY --from=build-env /go/bin/toml-cli /usr/bin/toml-cli -RUN apk add --no-cache ca-certificates=20230506-r0 libstdc++=12.2.1_git20220924-r10 jq=1.6-r4 curl=8.5.0-r0 bash=5.2.15-r5 vim=9.0.2073-r0 lz4=1.9.4-r4 rclone=1.62.2-r6 \ +RUN apk add --no-cache ca-certificates=20240226-r0 libstdc++=13.2.1_git20231014-r0 jq=1.7.1-r0 curl=8.5.0-r0 bash=5.2.21-r0 vim=9.0.2127-r0 lz4=1.9.4-r5 rclone=1.65.0-r3 \ && addgroup -g 1000 exocore \ && adduser -S -h /home/exocore -D exocore -u 1000 -G exocore diff --git a/Makefile b/Makefile index 653c3663c..145e30bd7 100644 --- a/Makefile +++ b/Makefile @@ -525,7 +525,9 @@ localnet-show-logstream: ############################################################################### PACKAGE_NAME:=github.com/ExocoreNetwork/exocore -GOLANG_CROSS_VERSION = v1.21.9 +# There is no `goreleaser-cross` package for 1.21.11, so we use the next +# available version of v1.22 with goreleaser version 2.0.0 +GOLANG_CROSS_VERSION = v1.22-v2.0.0 GOPATH ?= '$(HOME)/go' release-dry-run: docker run \ @@ -537,7 +539,7 @@ release-dry-run: -v ${GOPATH}/pkg:/go/pkg \ -w /go/src/$(PACKAGE_NAME) \ ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ - --clean --skip-validate --skip-publish --snapshot + --clean --skip validate,publish --snapshot release: @if [ ! -f ".release-env" ]; then \ diff --git a/app/app.go b/app/app.go index fcf0ab5a0..8b5ac52d9 100644 --- a/app/app.go +++ b/app/app.go @@ -591,6 +591,10 @@ func NewExocoreApp( app.AssetsKeeper, // assets for vote power ) + (&app.OperatorKeeper).SetHooks( + app.StakingKeeper.OperatorHooks(), + ) + (&app.EpochsKeeper).SetHooks( app.StakingKeeper.EpochsHooks(), ) @@ -939,12 +943,12 @@ func NewExocoreApp( app.mm.SetOrderEndBlockers( capabilitytypes.ModuleName, - crisistypes.ModuleName, // easy quit - stakingtypes.ModuleName, - operatorTypes.ModuleName, // after staking keeper - delegationTypes.ModuleName, // after operator keeper + crisistypes.ModuleName, // easy quit + operatorTypes.ModuleName, // first, so that USD value is recorded + stakingtypes.ModuleName, // uses the USD value recorded in operator to calculate vote power + delegationTypes.ModuleName, // process the undelegations matured by dogfood govtypes.ModuleName, // after staking keeper to ensure new vote powers - oracleTypes.ModuleName, // after staking keeper to ensure new vote powers + oracleTypes.ModuleName, // prepares for next round with new vote powers from staking keeper evmtypes.ModuleName, // can be anywhere feegrant.ModuleName, // can be anywhere // no-op modules diff --git a/app/ethtest_helper.go b/app/ethtest_helper.go index e4fcdcfaa..44bc857ef 100644 --- a/app/ethtest_helper.go +++ b/app/ethtest_helper.go @@ -4,6 +4,7 @@ import ( "encoding/json" "time" + "cosmossdk.io/math" "cosmossdk.io/simapp" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -252,6 +253,8 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState, Power: 1, }, }, + []dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1), ) genesisState[dogfoodtypes.ModuleName] = codec.MustMarshalJSON(dogfoodGenesis) diff --git a/app/export.go b/app/export.go index ff680c80b..20d95fb8d 100644 --- a/app/export.go +++ b/app/export.go @@ -55,7 +55,8 @@ func (app *ExocoreApp) ExportAppStateAndValidators( ) (servertypes.ExportedApp, error) { // Creates context with current height and checks txs for ctx to be usable by start of next // block - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}). + WithChainID(app.ChainID()) // We export at last height + 1, because that's the height at which // Tendermint will start InitChain. @@ -74,14 +75,13 @@ func (app *ExocoreApp) ExportAppStateAndValidators( return servertypes.ExportedApp{}, err } - validators, err := app.StakingKeeper.WriteValidators(ctx) - if err != nil { - return servertypes.ExportedApp{}, err - } + // the x/dogfood validator set is exported in its `val_set` key, and hence, + // does not need to be part of the app export. in other words, we do not + // duplicate the exported validator set. besides, as far as i can tell, the + // SDK does not use the Validators member of the ExportedApp struct. return servertypes.ExportedApp{ AppState: appState, - Validators: validators, Height: height, ConsensusParams: app.BaseApp.GetConsensusParams(ctx), }, nil diff --git a/app/test_helpers.go b/app/test_helpers.go index a2c7191d0..84f1cedda 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" + "cosmossdk.io/math" "cosmossdk.io/simapp" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" @@ -267,6 +268,8 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState, delegationGenesis := delegationtypes.NewGenesis(delegationsByStaker) genesisState[delegationtypes.ModuleName] = app.AppCodec().MustMarshalJSON(delegationGenesis) + // create a dogfood genesis with just the validator set, that is, the bare + // minimum valid genesis required to start a chain. dogfoodGenesis := dogfoodtypes.NewGenesis( dogfoodtypes.DefaultParams(), []dogfoodtypes.GenesisValidator{ { @@ -274,6 +277,9 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState, Power: 1, }, }, + []dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, + math.NewInt(1), // total vote power ) genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis) diff --git a/cmd/exocored/root.go b/cmd/exocored/root.go index d821df583..ec45f7600 100644 --- a/cmd/exocored/root.go +++ b/cmd/exocored/root.go @@ -265,22 +265,7 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a cast.ToUint32(appOpts.Get(sdkserver.FlagStateSyncSnapshotKeepRecent)), ) - // Setup chainId - chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) - if len(chainID) == 0 { - v := viper.New() - v.AddConfigPath(filepath.Join(home, "config")) - v.SetConfigName("client") - v.SetConfigType("toml") - if err := v.ReadInConfig(); err != nil { - panic(err) - } - conf := new(config.ClientConfig) - if err := v.Unmarshal(conf); err != nil { - panic(err) - } - chainID = conf.ChainID - } + chainID := getChainID(appOpts, home) evmosApp := app.NewExocoreApp( logger, db, traceStore, true, skipUpgradeHeights, @@ -323,17 +308,31 @@ func (a appCreator) appExport( return servertypes.ExportedApp{}, errors.New("application home not set") } + chainID := getChainID(appOpts, homePath) + if height != -1 { - evmosApp = app.NewExocoreApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), a.encCfg, appOpts) + evmosApp = app.NewExocoreApp( + logger, db, traceStore, false, + map[int64]bool{}, "", uint(1), a.encCfg, appOpts, + baseapp.SetChainID(chainID), + ) if err := evmosApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - evmosApp = app.NewExocoreApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1), a.encCfg, appOpts) + evmosApp = app.NewExocoreApp( + logger, db, traceStore, true, + map[int64]bool{}, "", uint(1), a.encCfg, appOpts, + baseapp.SetChainID(chainID), + ) } - return evmosApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) + return evmosApp.ExportAppStateAndValidators( + forZeroHeight, + jailAllowedAddrs, + modulesToExport, + ) } // initTendermintConfig helps to override default Tendermint Config values. @@ -350,3 +349,24 @@ func initTendermintConfig() *tmcfg.Config { return cfg } + +// getChainID loads the chainID from the flag or the config.toml file, with the +// former taking precedence over the latter. +func getChainID(appOpts servertypes.AppOptions, home string) string { + chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) + if len(chainID) == 0 { + v := viper.New() + v.AddConfigPath(filepath.Join(home, "config")) + v.SetConfigName("client") + v.SetConfigType("toml") + if err := v.ReadInConfig(); err != nil { + panic(err) + } + conf := new(config.ClientConfig) + if err := v.Unmarshal(conf); err != nil { + panic(err) + } + chainID = conf.ChainID + } + return chainID +} diff --git a/cmd/exocored/testnet.go b/cmd/exocored/testnet.go index 43e8333b6..77c165446 100644 --- a/cmd/exocored/testnet.go +++ b/cmd/exocored/testnet.go @@ -12,6 +12,7 @@ import ( "sort" "strings" + "cosmossdk.io/math" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -459,6 +460,7 @@ func getTestExocoreGenesis( Power: power, }) } + totalPower := math.NewInt(power * int64(len(operatorAddrs))) return assetstypes.NewGenesis( assetstypes.DefaultParams(), clientChains, []assetstypes.StakingAssetInfo{ @@ -482,6 +484,10 @@ func getTestExocoreGenesis( []string{assetID}, ), validators, + []dogfoodtypes.EpochToOperatorAddrs{}, + []dogfoodtypes.EpochToConsensusAddrs{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, + totalPower, ) } diff --git a/go.mod b/go.mod index fa3c6f35a..1dddb488d 100644 --- a/go.mod +++ b/go.mod @@ -1,22 +1,22 @@ module github.com/ExocoreNetwork/exocore -go 1.21.9 +go 1.21.11 require ( - cosmossdk.io/errors v1.0.0 - cosmossdk.io/math v1.1.2 + cosmossdk.io/errors v1.0.1 + cosmossdk.io/math v1.2.0 cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d cosmossdk.io/tools/rosetta v0.2.1 github.com/agiledragon/gomonkey/v2 v2.11.0 github.com/armon/go-metrics v0.4.1 - github.com/cometbft/cometbft v0.37.2 + github.com/cometbft/cometbft v0.37.4 github.com/cometbft/cometbft-db v0.8.0 github.com/cosmos/btcutil v1.0.5 github.com/cosmos/cosmos-proto v1.0.0-beta.3 - github.com/cosmos/cosmos-sdk v0.47.5 + github.com/cosmos/cosmos-sdk v0.47.8 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.4.11 - github.com/cosmos/ibc-go/v7 v7.2.1-0.20230829085526-4d114bd09096 + github.com/cosmos/ibc-go/v7 v7.4.0 github.com/ethereum/go-ethereum v1.13.5-0.20231027145059-2d7dba024d76 github.com/evmos/evmos/v14 v14.0.0-rc4 github.com/golang/protobuf v1.5.4 @@ -31,6 +31,7 @@ require ( github.com/smartystreets/goconvey v1.6.4 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 + github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 @@ -38,8 +39,9 @@ require ( golang.org/x/crypto v0.21.0 golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 - google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e - google.golang.org/grpc v1.57.1 + google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.33.0 gopkg.in/yaml.v2 v2.4.0 sigs.k8s.io/yaml v1.3.0 ) @@ -56,23 +58,23 @@ require ( github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/rs/cors v1.9.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/zondax/hid v0.9.1 // indirect + github.com/zondax/hid v0.9.2 // indirect golang.org/x/net v0.23.0 // indirect ) require ( - cloud.google.com/go v0.110.6 // indirect - cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go v0.111.0 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.1 // indirect + cloud.google.com/go/iam v1.1.5 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/core v0.6.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/log v1.2.1 // indirect + cosmossdk.io/log v1.3.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect + github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/aws/aws-sdk-go v1.44.224 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -91,9 +93,9 @@ require ( github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v0.20.0 // indirect + github.com/cosmos/iavl v0.20.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect + github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect @@ -117,12 +119,13 @@ require ( github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect - github.com/golang/glog v1.1.0 // indirect + github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect @@ -130,10 +133,10 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect - github.com/google/s2a-go v0.1.4 // indirect + github.com/google/s2a-go v0.1.7 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.11.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect @@ -193,14 +196,13 @@ require ( github.com/rivo/uniseg v0.4.4 // indirect github.com/rjeczalik/notify v0.9.3 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/rs/zerolog v1.30.0 // indirect + github.com/rs/zerolog v1.31.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect github.com/spf13/afero v1.10.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/supranational/blst v0.3.11 // indirect @@ -216,19 +218,21 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect - github.com/zondax/ledger-go v0.14.1 // indirect + github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.3.7 // indirect - golang.org/x/oauth2 v0.8.0 // indirect + go.opentelemetry.io/otel v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect + golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.19.0 // indirect - google.golang.org/api v0.126.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/api v0.149.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -240,7 +244,7 @@ replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // use Cosmos-SDK fork to enable Ledger functionality - github.com/cosmos/cosmos-sdk => github.com/evmos/cosmos-sdk v0.47.5-evmos + github.com/cosmos/cosmos-sdk => github.com/evmos/cosmos-sdk v0.47.5-evmos.2 //fix cosmos-sdk error github.com/cosmos/gogoproto => github.com/cosmos/gogoproto v1.4.10 // use Evmos geth fork diff --git a/go.sum b/go.sum index edd430d16..7a6fd963e 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRY cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= -cloud.google.com/go v0.110.6 h1:8uYAkj3YHTP/1iwReuHPxLSbdcyc+dSBbzFMrVwDR6Q= -cloud.google.com/go v0.110.6/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= +cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= +cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= @@ -148,8 +148,8 @@ cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARy cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= @@ -270,8 +270,8 @@ cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQE cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= cloud.google.com/go/iam v0.11.0/go.mod h1:9PiLDanza5D+oWFZiH1uG+RnRCfEGKoyl6yo4cgWZGY= cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= -cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= cloud.google.com/go/iap v1.6.0/go.mod h1:NSuvI9C/j7UdjGjIde7t7HBz+QTwBcapPE07+sSRcLk= @@ -523,12 +523,12 @@ cosmossdk.io/core v0.6.1 h1:OBy7TI2W+/gyn2z40vVvruK3di+cAluinA6cybFbE7s= cosmossdk.io/core v0.6.1/go.mod h1:g3MMBCBXtxbDWBURDVnJE7XML4BG5qENhs0gzkcpuFA= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= -cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= -cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= -cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= -cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= -cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= +cosmossdk.io/log v1.3.0 h1:L0Z0XstClo2kOU4h3V1iDoE5Ji64sg5HLOogzGg67Oo= +cosmossdk.io/log v1.3.0/go.mod h1:HIDyvWLqZe2ovlWabsDN4aPMpY/nUEquAhgfTf2ZzB8= +cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= +cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d h1:E/8y0oG3u9hBR8l4F9MtC0LdZIamPCUwUoLlrHrX86I= cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d/go.mod h1:xbjky3L3DJEylaho6gXplkrMvJ5sFgv+qNX+Nn47bzY= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= @@ -542,8 +542,8 @@ github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -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/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= +github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/ExocoreNetwork/evmos/v14 v14.1.1-0.20240408040728-a6f685cfebb9 h1:/jL9TiINGniPOG2bRfLmyCFSwMy/vFZ1Ta0OoE+xJaE= github.com/ExocoreNetwork/evmos/v14 v14.1.1-0.20240408040728-a6f685cfebb9/go.mod h1:Hi3CAMxAE+H7Fs7sSHsHKb4DZIURk+trop+mMrjlZqw= @@ -702,8 +702,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= -github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= +github.com/cometbft/cometbft v0.37.4 h1:xyvvEqlyfK8MgNIIKVJaMsuIp03wxOcFmVkT26+Ikpg= +github.com/cometbft/cometbft v0.37.4/go.mod h1:Cmg5Hp4sNpapm7j+x0xRyt2g0juQfmB752ous+pA0G8= github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= @@ -727,16 +727,16 @@ github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiK github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= -github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= -github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-go/v7 v7.2.1-0.20230829085526-4d114bd09096 h1:Z6MMhrD6j176jU5iTitkF09tpK0SAKDp/OCgvbE2cfE= -github.com/cosmos/ibc-go/v7 v7.2.1-0.20230829085526-4d114bd09096/go.mod h1:OOcjKIRku/j1Xs1RgKK0yvKRrJ5iFuZYMetR1n3yMlc= +github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= +github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= +github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8M= +github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= -github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= +github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= +github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= @@ -817,8 +817,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/evmos/cosmos-sdk v0.47.5-evmos h1:whqu51IyyDeINswUPNxDrm1WsvD7Bzo8XR71Ttt3DIc= -github.com/evmos/cosmos-sdk v0.47.5-evmos/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c= +github.com/evmos/cosmos-sdk v0.47.5-evmos.2 h1:fyhM0NYw/FnP4ZBXzQ7k+G4fXhfdU07MONoYrGlOCpc= +github.com/evmos/cosmos-sdk v0.47.5-evmos.2/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c= github.com/evmos/go-ethereum v1.10.26-evmos-rc2 h1:tYghk1ZZ8X4/OQ4YI9hvtm8aSN8OSqO0g9vo/sCMdBo= github.com/evmos/go-ethereum v1.10.26-evmos-rc2/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -873,8 +873,11 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= @@ -924,8 +927,9 @@ github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -1023,8 +1027,8 @@ github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8q github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= 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/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -1034,8 +1038,9 @@ github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99 github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= 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/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -1046,8 +1051,8 @@ github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= -github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -1228,13 +1233,11 @@ github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3v github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 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-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -1431,8 +1434,8 @@ github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= -github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= 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= @@ -1566,10 +1569,10 @@ github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPR github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= -github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= +github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= +github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= +github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= @@ -1585,6 +1588,14 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= +go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= +go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= +go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= +go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= +go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= @@ -1621,7 +1632,6 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= @@ -1773,8 +1783,8 @@ golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= 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= @@ -1869,7 +1879,6 @@ golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1905,6 +1914,7 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2088,8 +2098,8 @@ google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/ google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= -google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= +google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= 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= @@ -2097,8 +2107,9 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= 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= @@ -2229,12 +2240,12 @@ google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc/go.mod h1:RGgjbofJ google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e h1:z3vDksarJxsAKM5dmEGv0GHwE2hKJ096wZra71Vs4sw= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 h1:lv6/DhyiFFGsmzxbsUUTOkN29II+zeWHxvT8Lpdxsv0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= +google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= +google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= 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.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -2281,8 +2292,8 @@ google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsA google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= -google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 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= @@ -2337,8 +2348,8 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= -gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= 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= diff --git a/local_node.sh b/local_node.sh index deb48eb9f..a9446c33a 100755 --- a/local_node.sh +++ b/local_node.sh @@ -87,6 +87,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then # x/assets jq '.app_state["assets"]["client_chains"][0]["name"]="Example EVM chain"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["assets"]["client_chains"][0]["layer_zero_chain_id"]="101"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["assets"]["client_chains"][0]["address_length"]="20"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["assets"]["tokens"][0]["asset_basic_info"]["address"]="0xdAC17F958D2ee523a2206206994597C13D831ec7"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["assets"]["tokens"][0]["asset_basic_info"]["layer_zero_chain_id"]="101"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["assets"]["tokens"][0]["asset_basic_info"]["total_supply"]="40022689732746729"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -114,8 +115,23 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then jq '.app_state["delegation"]["delegations"][0]["delegations"][0]["per_operator_amounts"][0]["value"]["amount"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # x/dogfood - jq '.app_state["dogfood"]["initial_val_set"][0]["public_key"]="0xf0f6919e522c5b97db2c8255bff743f9dfddd7ad9fc37cb0c1670b480d0f9914"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["dogfood"]["initial_val_set"][0]["power"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["dogfood"]["val_set"][0]["public_key"]="0xf0f6919e522c5b97db2c8255bff743f9dfddd7ad9fc37cb0c1670b480d0f9914"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["dogfood"]["val_set"][0]["power"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + # change the epoch to an hour when starting a local node, which facilitates the testing. + jq '.app_state["dogfood"]["params"]["epoch_identifier"]="hour"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["dogfood"]["last_total_power"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + + # x/epochs + HOUR_EPOCH='{ + "identifier": "hour", + "start_time": "0001-01-01T00:00:00Z", + "duration": "3600s", + "current_epoch": "0", + "current_epoch_start_time": "0001-01-01T00:00:00Z", + "epoch_counting_started": false, + "current_epoch_start_height": "0" + }' + jq --argjson newEpoch "$HOUR_EPOCH" '.app_state["epochs"].epochs += [$newEpoch]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" if [[ $1 == "pending" ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then diff --git a/networks/local/exocore/Dockerfile b/networks/local/exocore/Dockerfile index 26042357a..d995356dc 100644 --- a/networks/local/exocore/Dockerfile +++ b/networks/local/exocore/Dockerfile @@ -1,5 +1,5 @@ -FROM golang:1.21.9-alpine3.18 AS build -RUN apk add --no-cache build-base=0.5-r3 linux-headers=6.3-r0 git=2.40.1-r0 +FROM golang:1.21.11-alpine3.19 AS build +RUN apk add --no-cache build-base=0.5-r3 git=2.43.4-r0 linux-headers=6.5-r0 # Set working directory for the build WORKDIR /go/work # Add source files @@ -9,8 +9,8 @@ COPY . ./ RUN LEDGER_ENABLED=false make build ##################################### -FROM alpine:3.18 AS run -RUN apk add --no-cache libstdc++=12.2.1_git20220924-r10 bash=5.2.15-r5 curl=8.5.0-r0 jq=1.6-r4 \ +FROM alpine:3.19 AS run +RUN apk add --no-cache libstdc++=13.2.1_git20231014-r0 bash=5.2.21-r0 curl=8.5.0-r0 jq=1.7.1-r0 \ && addgroup -g 1000 exocore \ && adduser -S -h /home/exocore -D exocore -u 1000 -G exocore EXPOSE 26656 26657 1317 9090 8545 8546 diff --git a/precompiles/avs/abi.json b/precompiles/avs/abi.json index 8b373648d..048950487 100644 --- a/precompiles/avs/abi.json +++ b/precompiles/avs/abi.json @@ -1,6 +1,11 @@ [ { "inputs": [ + { + "internalType": "string[]", + "name": "avsOwnerAddress", + "type": "string[]" + }, { "internalType": "string", "name": "avsName", @@ -8,13 +13,13 @@ }, { "internalType": "string", - "name": "avsAddress", + "name": "slashContractAddr", "type": "string" }, { - "internalType": "string", - "name": "operatorAddress", - "type": "string" + "internalType": "string[]", + "name": "assetID", + "type": "string[]" }, { "internalType": "uint64", @@ -22,14 +27,14 @@ "type": "uint64" }, { - "internalType": "string", - "name": "avsOwnerAddress", - "type": "string" + "internalType": "uint64", + "name": "minSelfDelegation", + "type": "uint64" }, { - "internalType": "string", - "name": "assetID", - "type": "string" + "internalType": "uint64", + "name": "unbondingPeriod", + "type": "uint64" } ], "name": "AVSAction", @@ -42,5 +47,24 @@ ], "stateMutability": "nonpayable", "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "action", + "type": "uint64" + } + ], + "name": "OperatorOptAction", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" } ] \ No newline at end of file diff --git a/precompiles/avs/avs.go b/precompiles/avs/avs.go index 0d37bfc8a..b1944f68e 100644 --- a/precompiles/avs/avs.go +++ b/precompiles/avs/avs.go @@ -73,7 +73,7 @@ func (p Precompile) RequiredGas(input []byte) uint64 { return p.Precompile.RequiredGas(input, p.IsTransaction(method.Name)) } -// Run executes the precompiled contract AVSInfoRegisterOrDeregister methods defined in the ABI. +// Run executes the precompiled contract RegisterOrDeregisterAVSInfo methods defined in the ABI. func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz []byte, err error) { ctx, stateDB, method, initialGas, args, err := p.RunSetup(evm, contract, readOnly, p.IsTransaction) if err != nil { @@ -84,8 +84,11 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ // It avoids panics and returns the out of gas error so the EVM can continue gracefully. defer cmn.HandleGasError(ctx, contract, initialGas, &err)() - if method.Name == MethodAVSAction { - bz, err = p.AVSInfoRegisterOrDeregister(ctx, evm.Origin, contract, stateDB, method, args) + switch method.Name { + case MethodAVSAction: + bz, err = p.RegisterOrDeregisterAVSInfo(ctx, evm.Origin, contract, stateDB, method, args) + case MethodOperatorAction: + bz, err = p.BindOperatorToAVS(ctx, evm.Origin, contract, stateDB, method, args) } if err != nil { @@ -108,7 +111,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ // - AVSRegister func (Precompile) IsTransaction(methodID string) bool { switch methodID { - case MethodAVSAction: + case MethodAVSAction, MethodOperatorAction: return true default: return false diff --git a/precompiles/avs/avs.sol b/precompiles/avs/avs.sol index cadc76390..8ec3f700e 100644 --- a/precompiles/avs/avs.sol +++ b/precompiles/avs/avs.sol @@ -14,11 +14,20 @@ IAVSManager constant AVSMANAGER_CONTRACT = IAVSManager( /// @custom:address 0x0000000000000000000000000000000000000902 interface IAVSManager { function AVSAction( + string[] memory avsOwnerAddress, string memory avsName, - string memory avsAddress, - string memory operatorAddress, + string memory slashContractAddr, + string[] memory assetID, uint64 action, - string memory avsOwnerAddress, - string memory assetID + uint64 minSelfDelegation, + uint64 unbondingPeriod ) external returns (bool success); -} \ No newline at end of file + + + function OperatorOptAction( + uint64 action + ) external returns (bool success); + +} + + diff --git a/precompiles/avs/avs_test.go b/precompiles/avs/avs_test.go index fe0d020d0..8283ce174 100644 --- a/precompiles/avs/avs_test.go +++ b/precompiles/avs/avs_test.go @@ -20,14 +20,14 @@ func (s *AVSManagerPrecompileSuite) TestIsTransaction() { isTx bool }{ { - avs.MethodAVSAction, - s.precompile.Methods[avs.MethodAVSAction].Name, + avs.MethodOperatorAction, + s.precompile.Methods[avs.MethodOperatorAction].Name, true, }, { - "invalid", - "invalid", - false, + avs.MethodAVSAction, + s.precompile.Methods[avs.MethodAVSAction].Name, + true, }, } @@ -39,9 +39,12 @@ func (s *AVSManagerPrecompileSuite) TestIsTransaction() { } func (s *AVSManagerPrecompileSuite) TestAVSManager() { - avsName, avsAddres, operatorAddress := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr" + avsName, operatorAddress, slashAddress := "avsTest", "exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph", "0xDF907c29719154eb9872f021d21CAE6E5025d7aB" + avsAction := avskeeper.RegisterAction - avsOwnderAddress, assetID := "0x123", "0x1" + from := s.Address + avsOwnerAddress := []string{"0x3e108c058e8066DA635321Dc3018294cA82ddEdf", "0xDF907c29719154eb9872f021d21CAE6E5025d7aB", from.String()} + assetID := []string{"11", "22", "33"} registerOperator := func() { registerReq := &operatortypes.RegisterOperatorReq{ FromAddress: operatorAddress, @@ -56,12 +59,13 @@ func (s *AVSManagerPrecompileSuite) TestAVSManager() { // prepare the call input for delegation test input, err := s.precompile.Pack( avs.MethodAVSAction, + avsOwnerAddress, avsName, - avsAddres, - operatorAddress, - uint64(avsAction), - avsOwnderAddress, + slashAddress, assetID, + uint64(avsAction), + uint64(10), + uint64(7), ) s.Require().NoError(err, "failed to pack input") return s.Address, input @@ -99,9 +103,9 @@ func (s *AVSManagerPrecompileSuite) TestAVSManager() { // malleate testcase caller, input := tc.malleate() - contract := vm.NewPrecompile(vm.AccountRef(caller), s.precompile, big.NewInt(0), uint64(1e6)) contract.Input = input + contract.CallerAddress = from contractAddr := contract.Address() // Build and sign Ethereum transaction diff --git a/precompiles/avs/tx.go b/precompiles/avs/tx.go index 8832574f6..337081984 100644 --- a/precompiles/avs/tx.go +++ b/precompiles/avs/tx.go @@ -1,29 +1,56 @@ package avs import ( + "fmt" + "slices" + + errorsmod "cosmossdk.io/errors" + + exocmn "github.com/ExocoreNetwork/exocore/precompiles/common" + util "github.com/ExocoreNetwork/exocore/utils" + avskeeper "github.com/ExocoreNetwork/exocore/x/avs/keeper" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/vm" + cmn "github.com/evmos/evmos/v14/precompiles/common" + "golang.org/x/xerrors" ) const ( - // AVSRegister defines the ABI method name for the avs - // related transaction. - MethodAVSAction = "AVSAction" + MethodAVSAction = "AVSAction" + MethodOperatorAction = "OperatorOptAction" ) // AVSInfoRegister register the avs related information and change the state in avs keeper module. -func (p Precompile) AVSInfoRegisterOrDeregister( +func (p Precompile) RegisterOrDeregisterAVSInfo( ctx sdk.Context, _ common.Address, - _ *vm.Contract, + contract *vm.Contract, _ vm.StateDB, method *abi.Method, args []interface{}, ) ([]byte, error) { // parse the avs input params first. avsParams, err := p.GetAVSParamsFromInputs(ctx, args) + if err != nil { + return nil, errorsmod.Wrap(err, "parse args error") + } + avsAddress, err := util.ProcessAddress(contract.Address().String()) + if err != nil { + return nil, errorsmod.Wrap(err, "parse avsAddress error") + } + + callerAddress, err := util.ProcessAddress(contract.CallerAddress.String()) + if err != nil { + return nil, errorsmod.Wrap(err, "parse callerAddress error") + } + + if !slices.Contains(avsParams.AvsOwnerAddress, callerAddress) { + return nil, errorsmod.Wrap(err, "not qualified to registerOrDeregister") + } + + avsParams.AvsAddress = avsAddress if err != nil { return nil, err } @@ -33,3 +60,44 @@ func (p Precompile) AVSInfoRegisterOrDeregister( } return method.Outputs.Pack(true) } + +func (p Precompile) BindOperatorToAVS( + ctx sdk.Context, + _ common.Address, + contract *vm.Contract, + _ vm.StateDB, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + if len(args) != 2 { + return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, 2, len(args)) + } + operatorParams := &avskeeper.OperatorOptParams{} + action, ok := args[0].(uint64) + if !ok || (action != avskeeper.RegisterAction && action != avskeeper.DeRegisterAction) { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 0, "uint64", action) + } + operatorParams.Action = action + + callerAddress, err := util.ProcessAddress(contract.CallerAddress.String()) + if err != nil { + return nil, errorsmod.Wrap(err, "parse callerAddress error") + } + + operatorParams.OperatorAddress = callerAddress + + avsAddress, err := util.ProcessAddress(contract.Address().String()) + if err != nil { + return nil, errorsmod.Wrap(err, "parse avsAddress error") + } + operatorParams.AvsAddress = avsAddress + if err != nil { + return nil, err + } + err = p.avsKeeper.AVSInfoUpdateWithOperator(ctx, operatorParams) + if err != nil { + return nil, err + } + + return method.Outputs.Pack(true) +} diff --git a/precompiles/avs/types.go b/precompiles/avs/types.go index a54b64306..f194fb0c4 100644 --- a/precompiles/avs/types.go +++ b/precompiles/avs/types.go @@ -10,56 +10,66 @@ import ( ) func (p Precompile) GetAVSParamsFromInputs(_ sdk.Context, args []interface{}) (*avstypes.AVSRegisterOrDeregisterParams, error) { - if len(args) != 6 { + if len(args) != 7 { return nil, xerrors.Errorf(cmn.ErrInvalidNumberOfArgs, 6, len(args)) } avsParams := &avstypes.AVSRegisterOrDeregisterParams{} - avsName, ok := args[0].(string) - if !ok { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 0, "string", avsName) + avsOwnerAddress, ok := args[0].([]string) + if !ok || avsOwnerAddress == nil { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 0, "[]string", avsOwnerAddress) } - avsParams.AvsName = avsName - avsAddress, ok := args[1].(string) - if !ok { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", avsAddress) + exoAddresses := make([]string, len(avsOwnerAddress)) + var err error + for i, addr := range avsOwnerAddress { + exoAddresses[i], err = util.ProcessAddress(addr) + if err != nil { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 0, "[]string", avsOwnerAddress) + } } - avsAddress, err := util.ProcessAvsAddress(avsAddress) - if err != nil { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", avsAddress) + + avsParams.AvsOwnerAddress = exoAddresses + + avsName, ok := args[1].(string) + if !ok || avsName == "" { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 1, "string", avsName) } - avsParams.AvsAddress = avsAddress + avsParams.AvsName = avsName - operatorAddress, ok := args[2].(string) - if !ok || operatorAddress == "" { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 2, "[]byte", operatorAddress) + slashContractAddr, ok := args[2].(string) + if !ok || slashContractAddr == "" { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 2, "string", slashContractAddr) } - operatorAddress, err = util.ProcessAvsAddress(operatorAddress) + slashContractAddr, err = util.ProcessAddress(slashContractAddr) if err != nil { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", operatorAddress) + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 2, "string", slashContractAddr) + } + avsParams.SlashContractAddr = slashContractAddr + + assetID, ok := args[3].([]string) + if !ok || assetID == nil { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "[]string", assetID) } - avsParams.OperatorAddress = operatorAddress - action, ok := args[3].(uint64) + avsParams.AssetID = assetID + + action, ok := args[4].(uint64) if !ok || (action != avstypes.RegisterAction && action != avstypes.DeRegisterAction) { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "uint64", action) + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 4, "uint64", action) } avsParams.Action = action - avsOwnerAddress, ok := args[4].(string) - if !ok || avsOwnerAddress == "" { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 4, "string", avsOwnerAddress) - } - avsOwnerAddress, err = util.ProcessAvsAddress(avsOwnerAddress) - if err != nil { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", avsOwnerAddress) + minSelfDelegation, ok := args[5].(uint64) + if !ok || (action != avstypes.RegisterAction && action != avstypes.DeRegisterAction) { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 5, "uint64", minSelfDelegation) } - avsParams.AvsOwnerAddress = avsOwnerAddress + avsParams.MinSelfDelegation = minSelfDelegation - assetID, ok := args[5].(string) - if !ok || assetID == "" { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "uint64", action) + unbondingPeriod, ok := args[6].(uint64) + if !ok || (action != avstypes.RegisterAction && action != avstypes.DeRegisterAction) { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 6, "uint64", unbondingPeriod) } - avsParams.AssetID = assetID + avsParams.UnbondingPeriod = unbondingPeriod + return avsParams, nil } diff --git a/precompiles/avsTask/task.go b/precompiles/avsTask/task.go index b821216ab..0f423ea58 100644 --- a/precompiles/avsTask/task.go +++ b/precompiles/avsTask/task.go @@ -80,7 +80,7 @@ func (p Precompile) RequiredGas(input []byte) uint64 { return p.Precompile.RequiredGas(input, p.IsTransaction(method.Name)) } -// Run executes the precompiled contract AVSInfoRegisterOrDeregister methods defined in the ABI. +// Run executes the precompiled contract RegisterOrDeregisterAVSInfo methods defined in the ABI. func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz []byte, err error) { ctx, stateDB, method, initialGas, args, err := p.RunSetup(evm, contract, readOnly, p.IsTransaction) if err != nil { diff --git a/precompiles/avsTask/task_test.go b/precompiles/avsTask/task_test.go index 2985df691..125710751 100644 --- a/precompiles/avsTask/task_test.go +++ b/precompiles/avsTask/task_test.go @@ -2,6 +2,8 @@ package task_test import ( "encoding/hex" + "github.com/ExocoreNetwork/exocore/x/avs/types" + sdk "github.com/cosmos/cosmos-sdk/types" "math/big" "github.com/ExocoreNetwork/exocore/app" @@ -41,11 +43,25 @@ func (s *TaskPrecompileTestSuite) TestIsTransaction() { // TestRun tests the precompiles Run method reg avstask. func (s *TaskPrecompileTestSuite) TestRunRegTaskinfo() { - avsName, avsAddres, operatorAddress, assetID := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo18h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "" + avsName, avsAddres, slashAddress := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutash" + avsOwnerAddress := []string{"exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj1", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj2"} + assetID := []string{"11", "22", "33"} _, byteData, _ := bech32.DecodeToBase256(avsAddres) caller := "0x" + hex.EncodeToString(byteData) + avs := &types.AVSInfo{ + Name: avsName, + AvsAddress: avsAddres, + SlashAddr: slashAddress, + AvsOwnerAddress: avsOwnerAddress, + AssetId: assetID, + AvsUnbondingPeriod: uint32(7), + MinSelfDelegation: sdk.NewIntFromUint64(10), + AvsEpoch: nil, + OperatorAddress: nil, + } + registerAvs := func() { - err := s.App.AVSManagerKeeper.SetAVSInfo(s.Ctx, avsName, avsAddres, operatorAddress, assetID) + err := s.App.AVSManagerKeeper.SetAVSInfo(s.Ctx, avs) s.NoError(err) } commonMalleate := func() (common.Address, []byte) { diff --git a/precompiles/clientchains/tx.go b/precompiles/clientchains/tx.go index 684ca0aa5..9ce49bdcf 100644 --- a/precompiles/clientchains/tx.go +++ b/precompiles/clientchains/tx.go @@ -15,11 +15,21 @@ func (p Precompile) GetClientChains( args []interface{}, ) ([]byte, error) { if len(args) > 0 { - return nil, errorsmod.Wrapf(assetstypes.ErrInvalidInputParameter, "no input is required") + ctx.Logger().Error( + "GetClientChains", + "err", errorsmod.Wrapf( + assetstypes.ErrInvalidInputParameter, "no input is required", + ), + ) + return method.Outputs.Pack(false, nil) } infos, err := p.assetsKeeper.GetAllClientChainInfo(ctx) if err != nil { - return nil, err + ctx.Logger().Error( + "GetClientChains", + "err", err, + ) + return method.Outputs.Pack(false, nil) } ids := make([]uint16, 0, len(infos)) for id := range infos { @@ -27,9 +37,13 @@ func (p Precompile) GetClientChains( // based it on uint16, so we have to stick with it. // TODO: change it to uint32 here and in other precompiles. if id > math.MaxUint16 { - return nil, errorsmod.Wrapf( - assetstypes.ErrInvalidInputParameter, "client chain id is too large", + ctx.Logger().Error( + "GetClientChains", + "err", errorsmod.Wrapf( + assetstypes.ErrInvalidInputParameter, "client chain id is too large", + ), ) + return method.Outputs.Pack(false, nil) } // #nosec G701 // already checked convID := uint16(id) diff --git a/precompiles/delegation/delegation.go b/precompiles/delegation/delegation.go index 0181d8c1a..24fa84cf5 100644 --- a/precompiles/delegation/delegation.go +++ b/precompiles/delegation/delegation.go @@ -99,7 +99,11 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ if err != nil { ctx.Logger().Error("call delegation precompile error", "module", "delegation precompile", "err", err) - return nil, err + // for failed cases we expect it returns bool value instead of error + // this is a workaround because the error returned by precompile can not be caught in EVM + // see https://github.com/ExocoreNetwork/exocore/issues/70 + // TODO: we should figure out root cause and fix this issue to make precompiles work normally + return method.Outputs.Pack(false) } cost := ctx.GasMeter().GasConsumed() - initialGas diff --git a/precompiles/delegation/delegation_test.go b/precompiles/delegation/delegation_test.go index 76c5c7a2e..482b3c83a 100644 --- a/precompiles/delegation/delegation_test.go +++ b/precompiles/delegation/delegation_test.go @@ -111,6 +111,9 @@ func (s *DelegationPrecompileSuite) TestRunDelegateToThroughClientChain() { successRet, err := s.precompile.Methods[delegation.MethodDelegateToThroughClientChain].Outputs.Pack(true) s.Require().NoError(err) + failureRet, err := s.precompile.Methods[delegation.MethodDelegateToThroughClientChain].Outputs.Pack(false) + s.Require().NoError(err) + testcases := []struct { name string malleate func() (common.Address, []byte) @@ -126,7 +129,7 @@ func (s *DelegationPrecompileSuite) TestRunDelegateToThroughClientChain() { }, readOnly: false, expPass: false, - errContains: assetstype.ErrNotEqualToLzAppAddr.Error(), + returnBytes: failureRet, }, { name: "fail - delegateToThroughClientChain transaction will fail because the contract caller isn't the exoCoreLzAppAddr", @@ -141,7 +144,7 @@ func (s *DelegationPrecompileSuite) TestRunDelegateToThroughClientChain() { }, readOnly: false, expPass: false, - errContains: types.ErrNotEqualToLzAppAddr.Error(), + returnBytes: failureRet, }, { name: "fail - delegateToThroughClientChain transaction will fail because the delegated operator hasn't been registered", @@ -156,7 +159,7 @@ func (s *DelegationPrecompileSuite) TestRunDelegateToThroughClientChain() { }, readOnly: false, expPass: false, - errContains: delegationtype.ErrOperatorNotExist.Error(), + returnBytes: failureRet, }, { name: "fail - delegateToThroughClientChain transaction will fail because the delegated asset hasn't been deposited", @@ -172,7 +175,7 @@ func (s *DelegationPrecompileSuite) TestRunDelegateToThroughClientChain() { }, readOnly: false, expPass: false, - errContains: types.ErrNoStakerAssetKey.Error(), + returnBytes: failureRet, }, { name: "fail - delegateToThroughClientChain transaction will fail because the delegation amount is bigger than the canWithdraw amount", @@ -189,7 +192,7 @@ func (s *DelegationPrecompileSuite) TestRunDelegateToThroughClientChain() { }, readOnly: false, expPass: false, - errContains: delegationtype.ErrDelegationAmountTooBig.Error(), + returnBytes: failureRet, }, { name: "pass - delegateToThroughClientChain transaction", @@ -273,9 +276,12 @@ func (s *DelegationPrecompileSuite) TestRunDelegateToThroughClientChain() { s.Require().NoError(err, "expected no error when running the precompile") s.Require().Equal(tc.returnBytes, bz, "the return doesn't match the expected result") } else { - s.Require().Error(err, "expected error to be returned when running the precompile") - s.Require().Nil(bz, "expected returned bytes to be nil") - s.Require().ErrorContains(err, tc.errContains) + // for failed cases we expect it returns bool value instead of error + // this is a workaround because the error returned by precompile can not be caught in EVM + // see https://github.com/ExocoreNetwork/exocore/issues/70 + // TODO: we should figure out root cause and fix this issue to make precompiles work normally + s.Require().NoError(err, "expected no error when running the precompile") + s.Require().Equal(tc.returnBytes, bz, "expected returned bytes to be nil") } }) } @@ -439,9 +445,12 @@ func (s *DelegationPrecompileSuite) TestRunUnDelegateFromThroughClientChain() { s.Require().NoError(err, "expected no error when running the precompile") s.Require().Equal(tc.returnBytes, bz, "the return doesn't match the expected result") } else { - s.Require().Error(err, "expected error to be returned when running the precompile") - s.Require().Nil(bz, "expected returned bytes to be nil") - s.Require().ErrorContains(err, tc.errContains) + // for failed cases we expect it returns bool value instead of error + // this is a workaround because the error returned by precompile can not be caught in EVM + // see https://github.com/ExocoreNetwork/exocore/issues/70 + // TODO: we should figure out root cause and fix this issue to make precompiles work normally + s.Require().NoError(err, "expected no error when running the precompile") + s.Require().Equal(tc.returnBytes, bz, "expected returned bytes to be nil") } }) } diff --git a/precompiles/delegation/tx.go b/precompiles/delegation/tx.go index 71df9f487..ab01ec4e8 100644 --- a/precompiles/delegation/tx.go +++ b/precompiles/delegation/tx.go @@ -68,7 +68,7 @@ func (p Precompile) UndelegateFromThroughClientChain( return nil, errorsmod.Wrap(err, exocmn.ErrContractCaller) } - UndelegationParams, err := p.GetDelegationParamsFromInputs(ctx, args) + undelegationParams, err := p.GetDelegationParamsFromInputs(ctx, args) if err != nil { return nil, err } @@ -77,9 +77,9 @@ func (p Precompile) UndelegateFromThroughClientChain( if !ok || txHash.Bytes() == nil { return nil, fmt.Errorf(ErrCtxTxHash, reflect.TypeOf(ctx.Value(CtxKeyTxHash)), txHash) } - UndelegationParams.TxHash = txHash + undelegationParams.TxHash = txHash - err = p.delegationKeeper.UndelegateFrom(ctx, UndelegationParams) + err = p.delegationKeeper.UndelegateFrom(ctx, undelegationParams) if err != nil { return nil, err } diff --git a/precompiles/reward/reward.go b/precompiles/reward/reward.go index aa04c1e59..e8ff0f9d7 100644 --- a/precompiles/reward/reward.go +++ b/precompiles/reward/reward.go @@ -4,6 +4,7 @@ import ( "bytes" "embed" "fmt" + "math/big" assetskeeper "github.com/ExocoreNetwork/exocore/x/assets/keeper" rewardkeeper "github.com/ExocoreNetwork/exocore/x/reward/keeper" @@ -96,7 +97,11 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ } if err != nil { - return nil, err + // for failed cases we expect it returns bool value instead of error + // this is a workaround because the error returned by precompile can not be caught in EVM + // see https://github.com/ExocoreNetwork/exocore/issues/70 + // TODO: we should figure out root cause and fix this issue to make precompiles work normally + return method.Outputs.Pack(false, new(big.Int)) } cost := ctx.GasMeter().GasConsumed() - initialGas diff --git a/precompiles/reward/reward_test.go b/precompiles/reward/reward_test.go index 75170823d..e40131244 100644 --- a/precompiles/reward/reward_test.go +++ b/precompiles/reward/reward_test.go @@ -171,9 +171,12 @@ func (s *RewardPrecompileTestSuite) TestRunRewardThroughClientChain() { s.Require().NoError(err, "expected no error when running the precompile") s.Require().Equal(tc.returnBytes, bz, "the return doesn't match the expected result") } else { - s.Require().Error(err, "expected error to be returned when running the precompile") - s.Require().Nil(bz, "expected returned bytes to be nil") - s.Require().ErrorContains(err, tc.errContains) + // for failed cases we expect it returns bool value instead of error + // this is a workaround because the error returned by precompile can not be caught in EVM + // see https://github.com/ExocoreNetwork/exocore/issues/70 + // TODO: we should figure out root cause and fix this issue to make precompiles work normally + s.Require().NoError(err, "expected no error when running the precompile") + s.Require().Equal(tc.returnBytes, bz, "expected returned bytes to be nil") } }) } diff --git a/precompiles/withdraw/withdraw.go b/precompiles/withdraw/withdraw.go index 2e55b7121..c5578b705 100644 --- a/precompiles/withdraw/withdraw.go +++ b/precompiles/withdraw/withdraw.go @@ -4,6 +4,7 @@ import ( "bytes" "embed" "fmt" + "math/big" assetskeeper "github.com/ExocoreNetwork/exocore/x/assets/keeper" withdrawkeeper "github.com/ExocoreNetwork/exocore/x/withdraw/keeper" @@ -96,7 +97,11 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ } if err != nil { - return nil, err + // for failed cases we expect it returns bool value instead of error + // this is a workaround because the error returned by precompile can not be caught in EVM + // see https://github.com/ExocoreNetwork/exocore/issues/70 + // TODO: we should figure out root cause and fix this issue to make precompiles work normally + return method.Outputs.Pack(false, new(big.Int)) } cost := ctx.GasMeter().GasConsumed() - initialGas diff --git a/precompiles/withdraw/withdraw_integrate_test.go b/precompiles/withdraw/withdraw_integrate_test.go index 710437bc0..9864304ef 100644 --- a/precompiles/withdraw/withdraw_integrate_test.go +++ b/precompiles/withdraw/withdraw_integrate_test.go @@ -3,8 +3,6 @@ package withdraw_test import ( "math/big" - exocmn "github.com/ExocoreNetwork/exocore/precompiles/common" - "github.com/ExocoreNetwork/exocore/precompiles/testutil" "github.com/ExocoreNetwork/exocore/precompiles/testutil/contracts" assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" @@ -68,6 +66,27 @@ func (s *WithdrawPrecompileTestSuite) TestCallWithdrawFromEOA() { beforeEach() setWithdrawArgs := prepareFunc(¶ms, method) - _, _, err := contracts.CallContractAndCheckLogs(s.Ctx, s.App, setWithdrawArgs, passCheck) - s.Require().ErrorContains(err, exocmn.ErrContractCaller) + _, response, err := contracts.CallContractAndCheckLogs(s.Ctx, s.App, setWithdrawArgs, passCheck) + + // for failed cases we expect it returns bool value instead of error + // this is a workaround because the error returned by precompile can not be caught in EVM + // see https://github.com/ExocoreNetwork/exocore/issues/70 + // TODO: we should figure out root cause and fix this issue to make precompiles work normally + s.Require().NoError(err) + + result, err := setWithdrawArgs.ContractABI.Unpack(method, response.Ret) + s.Require().NoError((err)) + + // solidity: function withdraw(...) returns (bool success, uint256 updatedBalance) + s.Require().Equal(len(result), 2) + + // the first element should be bool value that indicates whether the withdrawal is successful + success, ok := result[0].(bool) + s.Require().True(ok) + s.Require().False(success) + + // the second element represents updatedBalance and should be 0 since success is false and withdrawal has failed + updatedBalance, ok := result[1].(*big.Int) + s.Require().True(ok) + s.Require().Zero(updatedBalance.Cmp(new(big.Int))) } diff --git a/proto/exocore/assets/v1/query.proto b/proto/exocore/assets/v1/query.proto index 18a22a7b7..86233a0e6 100644 --- a/proto/exocore/assets/v1/query.proto +++ b/proto/exocore/assets/v1/query.proto @@ -155,10 +155,5 @@ service Query { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/assets/v1/QueStakerSpecifiedAssetAmount"; } - // StakerExCoreAddr queries the staker exocore address. - rpc QueStakerExoCoreAddr(QueryStakerExCoreAddr) returns (QueryStakerExCoreAddrResponse) { - option (cosmos.query.v1.module_query_safe) = true; - option (google.api.http).get = "/exocore/assets/v1/QueStakerExoCoreAddr/{staker}"; - } } diff --git a/proto/exocore/assets/v1/tx.proto b/proto/exocore/assets/v1/tx.proto index 113ce431c..a5a7b1754 100644 --- a/proto/exocore/assets/v1/tx.proto +++ b/proto/exocore/assets/v1/tx.proto @@ -41,20 +41,6 @@ message ClientChainInfo { uint32 address_length = 8; } -// AppChainInfo is used to store information related to the subscriber app chains we validate. -// The information stored within this module consists only of the chain's identifiers. -// The validation-related information is stored in the coordinator module. -message AppChainInfo { - // name of the chain, for example "ethereum" - string name = 1; - // meta_info is at Exocore's discretion to deter,ome - string meta_info = 2; - // chain_id is used as the primary key - string chain_id = 3 [(gogoproto.customname) = "ChainID"]; - // exocore_chain_index is the index of the chain in exocore, so far unused - uint64 exocore_chain_index = 4; -} - // AssetInfo defines the information for an asset to be used in staking. message AssetInfo { // name of the asset, like "Tether USD" diff --git a/proto/exocore/avs/tx.proto b/proto/exocore/avs/tx.proto index 244fddc35..28e874e21 100644 --- a/proto/exocore/avs/tx.proto +++ b/proto/exocore/avs/tx.proto @@ -2,6 +2,9 @@ syntax = "proto3"; package exocore.avs; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/avs/types"; @@ -11,14 +14,55 @@ message AVSInfo { string name = 1; // address of avs string avs_address = 2; - // registered operator of avs - repeated string operator_address = 3; + // slash address of avs + string slash_addr = 3; // the owner who has permission for avs - string avs_owner_address = 4; + repeated string avs_owner_address = 4; // asset_basic_info is all the basic asset information of the avs. repeated string asset_id = 5; + // unbonding duration of avs. + uint32 avs_unbonding_period = 6; + // the operator minimum delegation amount. + string min_self_delegation = 7 + [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + //avs epoch ,Subsequently will be handled by the epochs module. + EpochInfo avs_epoch = 8; + // registered operator of avs + repeated string operator_address = 9; } +// EpochInfo defines the message interface containing the relevant informations aboutt +// an epoch. +message EpochInfo { + // identifier of the epoch + string identifier = 1; + // start_time of the epoch + google.protobuf.Timestamp start_time = 2 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"start_time\""]; + // duration of the epoch + google.protobuf.Duration duration = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "duration,omitempty", + (gogoproto.moretags) = "yaml:\"duration\"" + ]; + // current_epoch is the integer identifier of the epoch + int64 current_epoch = 4; + // current_epoch_start_time defines the timestamp of the start of the epoch + google.protobuf.Timestamp current_epoch_start_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"current_epoch_start_time\"" + ]; + // epoch_counting_started reflects if the counting for the epoch has started + bool epoch_counting_started = 6; + // current_epoch_start_height of the epoch + int64 current_epoch_start_height = 7; +} // RegisterAVSReq is requst to register avs message RegisterAVSReq { // from_address is the source diff --git a/proto/exocore/delegation/v1/query.proto b/proto/exocore/delegation/v1/query.proto index 1334c73c5..7bffde827 100644 --- a/proto/exocore/delegation/v1/query.proto +++ b/proto/exocore/delegation/v1/query.proto @@ -69,6 +69,18 @@ message SingleDelegationInfoReq { string asset_id = 3 [(gogoproto.customname) = "AssetID"]; } +// UndelegationHoldCountReq is the request to obtain the undelegation hold count. +message UndelegationHoldCountReq { + // record_key is the record key of the undelegation record. + string record_key = 1; +} + +// UndelegationHoldCountResponse is the response for the undelegation hold count. +message UndelegationHoldCountResponse { + // hold_count is the number of undelegations that are on hold. + uint64 hold_count = 1; +} + // Query is the service API for the delegation module. service Query { // DelegationInfo queries the delegation information for {stakerID, assetID}. @@ -82,5 +94,11 @@ service Query { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/exocore/delegation/v1/QuerySingleDelegationInfo"; } + + // QueryUndelegationHoldCount queries the undelegation hold count. + rpc QueryUndelegationHoldCount(UndelegationHoldCountReq) returns (UndelegationHoldCountResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/exocore/delegation/v1/QueryUndelegationHoldCount/{record_key}"; + } } diff --git a/proto/exocore/dogfood/v1/dogfood.proto b/proto/exocore/dogfood/v1/dogfood.proto index 8db8a9493..ef30d1f32 100644 --- a/proto/exocore/dogfood/v1/dogfood.proto +++ b/proto/exocore/dogfood/v1/dogfood.proto @@ -33,13 +33,6 @@ message AccountAddresses { repeated bytes list = 1; } -// ConsensusAddresses represents a list of account addresses. It is used to store the list of -// addresses (which correspond to operator public keys) to delete at the end of an epoch. -message ConsensusAddresses { - // list is the list of consensus addresses. - repeated bytes list = 1; -} - // UndelegationRecordKeys is a collection of undelegation record keys. This is used to store a // list of undelegation records to mature in the delegation module at the end of the epoch. message UndelegationRecordKeys { @@ -52,3 +45,9 @@ message Validators { // list is the list of validators. repeated cosmos.staking.v1beta1.Validator list = 1 [(gogoproto.nullable) = false]; } + +// ConsensusAddresses is a list of consensus addresses. +message ConsensusAddresses { + // list is the list of consensus addresses. + repeated bytes list = 1; +} \ No newline at end of file diff --git a/proto/exocore/dogfood/v1/genesis.proto b/proto/exocore/dogfood/v1/genesis.proto index c81b3070c..ee2005560 100644 --- a/proto/exocore/dogfood/v1/genesis.proto +++ b/proto/exocore/dogfood/v1/genesis.proto @@ -2,24 +2,78 @@ syntax = "proto3"; package exocore.dogfood.v1; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "exocore/dogfood/v1/params.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; -// GenesisState defines the dogfood module's genesis state. +// GenesisState defines the dogfood module's genesis state. Note that, as always, +// `genesis` is a misnomer. Ideally, this state can be exported at any point in +// time (or height), and reimported elsewhere where it will be the new genesis +// potentially at a non-zero height. In other words, it is the entire, current, +// state of the module. message GenesisState { // params refers to the parameters of the module. Params params = 1 [(gogoproto.nullable) = false]; - // initial_val_set is the initial validator set. - repeated GenesisValidator initial_val_set = 2 + // val_set is the initial validator set. it onyl represents the active + // validators. + repeated GenesisValidator val_set = 2 [ (gogoproto.nullable) = false ]; + + // opt_out_expiries is a list of (future) epochs at the end of which the + // corresponding operators' opt-out will expire. we store this, as well as its reverse + // lookup. + repeated EpochToOperatorAddrs opt_out_expiries = 3 + [ (gogoproto.nullable) = false ]; + + // epochs_consensus_addrs is a list of epochs at the end of which the corresponding + // consensus addresses should be pruned from the operator module. + repeated EpochToConsensusAddrs consensus_addrs_to_prune = 4 + [ (gogoproto.nullable) = false ]; + + // undelegation_maturities is a list of epochs at the end of which the corresponding + // undelegations will mature. we store its reverse lookup as well. + repeated EpochToUndelegationRecordKeys undelegation_maturities = 5 + [ (gogoproto.nullable) = false ]; + + // data against HistoricalInfoBytePrefix is not made available in the module + // state for import / export. this is in line with Cosmos SDK. + + // the data indexed by the pending keys is created within the epochs hooks + // which happen in the BeginBlocker. it is applied during the EndBlocker and + // then immediately cleared. + // remember that data can be exported from a node that is stopped. + // a node can be stopped only if it has committed a block. if a full + // block is committed, data that is saved to state during BeginBlock + // and cleared at EndBlock will not be available. hence, we don't need + // to make data for any of the `pending` keys available here. + + // last_total_power tracks the total voting power as of the last validator set + // update. such an update is most likely to be at the end of the last epoch (or the + // beginning of this one, to be more precise) and less likely to be at other blocks, + // since the validator set can otherwise only change as a result of slashing events. + bytes last_total_power = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // validator_updates is a list of validator updates applied at the end of the previous + // block. it is then cleared at the end of the next block, and hence, is available + // for other modules to access during that block. however, for a new chain, it does + // not make sense for it to exist, since all of the validators should be considered + // as an update. this behaviour is the same as the Cosmos SDK. } // GenesisValidator defines a genesis validator. It is a helper struct -// used for serializing the genesis state. +// used for serializing the genesis state. The only reason it is a different +// structure is to support importing hex public keys from Solidity. +// TODO: consider this set up when resolving issue 73 about storage +// optimization between dogfood and operator modules. +// https://github.com/ExocoreNetwork/exocore/issues/73 message GenesisValidator { // public_key is the consensus public key of the validator. It should // be exactly 32 bytes, but this is not enforced in protobuf. @@ -27,3 +81,34 @@ message GenesisValidator { // power is the voting power of the validator. int64 power = 2; } + +// EpochToOperatorAddress is used to store a mapping from epoch to a list of +// operator account addresses. +message EpochToOperatorAddrs { + // epoch is the epoch in question. + int64 epoch = 1; + // operator_acc_addrs is the list of account addresses to expire at this epoch. + // It is of type string for human readability of the genesis file. + repeated string operator_acc_addrs = 2; +} + +// EpochToConsensusAddrs is used to store a mapping from the epoch to a list of +// consensus addresses. +message EpochToConsensusAddrs { + // epoch is the epoch in question. + int64 epoch = 1; + // cons_addrs is the list of consensus addresses to prune at this epoch. + // It is of type string for human readability of the genesis file. + repeated string cons_addrs = 2; +} + +// EpochToUndelegationRecordKeys is used to store a mapping from an epoch to a list of +// undelegations which mature at that epoch. +message EpochToUndelegationRecordKeys { + // epoch is the epoch in question. + int64 epoch = 1; + // undelegation_record_keys is the list of undelegations (defined by the record key) + // to expire at this epoch. + // It is of type string for human readability of the genesis file. + repeated string undelegation_record_keys = 2; +} \ No newline at end of file diff --git a/proto/exocore/dogfood/v1/query.proto b/proto/exocore/dogfood/v1/query.proto index 111b0c8e8..ec563a83b 100644 --- a/proto/exocore/dogfood/v1/query.proto +++ b/proto/exocore/dogfood/v1/query.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package exocore.dogfood.v1; +import "exocore/dogfood/v1/dogfood.proto"; import "exocore/dogfood/v1/params.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; @@ -10,10 +11,39 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/dogfood/types"; // Query defines the gRPC querier service. service Query { - // Parameters queries the parameters of the module. + // Params queries the parameters of the module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/exocore/dogfood/params"; } + + // OptOutsToFinish queries the operators whose opt-outs will finish at the given epoch. + rpc OptOutsToFinish(QueryOptOutsToFinishRequest) returns (AccountAddresses) { + option (google.api.http).get = "/exocore/dogfood/opt_outs_to_finish/{epoch}"; + } + + // OperatorOptOutFinishEpoch queries the epoch when the operator's opt-out will finish. + rpc OperatorOptOutFinishEpoch(QueryOperatorOptOutFinishEpochRequest) returns ( + QueryOperatorOptOutFinishEpochResponse + ) { + option (google.api.http).get = "/exocore/dogfood/operator_opt_out_finish_epoch/{operator_acc_addr}"; + } + + // UndelegationsToMature queries the undelegations that will mature at the given epoch. + rpc UndelegationsToMature(QueryUndelegationsToMatureRequest) returns (UndelegationRecordKeys) { + option (google.api.http).get = "/exocore/dogfood/undelegations_to_mature/{epoch}"; + } + + // UndelegationMaturityEpoch queries the epoch when the undelegation will mature. + rpc UndelegationMaturityEpoch(QueryUndelegationMaturityEpochRequest) returns ( + QueryUndelegationMaturityEpochResponse + ) { + option (google.api.http).get = "/exocore/dogfood/undelegation_maturity_epoch/{record_key}"; + } + + // QueryValidator queries the validator for the given consensus address. + rpc QueryValidator(QueryValidatorRequest) returns (ExocoreValidator) { + option (google.api.http).get = "/exocore/dogfood/validator/{cons_addr}"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -23,4 +53,52 @@ message QueryParamsRequest {} message QueryParamsResponse { // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false]; +} + +// QueryOptOutsToFinishRequest is request type for the Query/OptOutsToFinish RPC method. +message QueryOptOutsToFinishRequest { + // epoch is the epoch to query opt-outs for. + int64 epoch = 1; +} + +// QueryOperatorOptOutFinishEpochRequest is request type for the Query/OperatorOptOutFinishEpoch +// RPC method. +message QueryOperatorOptOutFinishEpochRequest { + // operator_acc_addr is the operator account address. + string operator_acc_addr = 1; +} + +// QueryOperatorOptOutFinishEpochResponse is response type for the +// Query/OperatorOptOutFinishEpoch RPC method. +message QueryOperatorOptOutFinishEpochResponse { + // epoch is the epoch when the operator's opt-out will finish. + int64 epoch = 1; +} + +// QueryUndelegationsToMatureRequest is request type for the Query/UndelegationsToMature RPC method. +message QueryUndelegationsToMatureRequest { + // epoch is the epoch to query undelegations for. + int64 epoch = 1; +} + +// QueryUndelegationMaturityEpochRequest is request type for the Query/UndelegationMaturityEpoch +// RPC method. +message QueryUndelegationMaturityEpochRequest { + // record_key is the undelegation record key. note that the UndelegationRecordKey used by the + // delegation module is just a string converted to bytes, which we will reverse here. + string record_key = 1; +} + +// QueryUndelegationMaturityEpochResponse is response type for the +// Query/UndelegationMaturityEpoch RPC method. +message QueryUndelegationMaturityEpochResponse { + // epoch is the epoch when the undelegation will mature. + int64 epoch = 1; +} + +// QueryValidatorRequest is request type for the Query/QueryValidator RPC method. +message QueryValidatorRequest { + // cons_addr is the consensus address of the validator being queried. From the perspective of + // this module, the acc_addr is not relevant and is thus not stored. + string cons_addr = 1; } \ No newline at end of file diff --git a/proto/exocore/operator/v1/query.proto b/proto/exocore/operator/v1/query.proto index e9e53c643..757d093c8 100644 --- a/proto/exocore/operator/v1/query.proto +++ b/proto/exocore/operator/v1/query.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package exocore.operator.v1; +import "cosmos/base/query/v1beta1/pagination.proto"; import "cosmos_proto/cosmos.proto"; import "exocore/operator/v1/tx.proto"; import "gogoproto/gogo.proto"; @@ -16,32 +17,169 @@ message GetOperatorInfoReq { [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// QueryOperatorConsKeyRequest is the request to obtain the consensus public key of the operator +// QueryAllOperatorsRequest is the request to obtain all operators. +message QueryAllOperatorsRequest { + // pagination related options. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryAllOperatorsResponse is the response containing all operator account addresses. +message QueryAllOperatorsResponse { + // operators is a list of all operators. + repeated string operator_acc_addrs = 1; + // pagination related response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryOperatorConsKeyRequest is a request to obtain the consensus public key of the operator. message QueryOperatorConsKeyRequest { - // addr is the ACC address of operator - string addr = 1; - // chain_id is the id of the chain served by the operator - string chain_id = 2; + // operator_acc_addr is the operator account address. + string operator_acc_addr = 1; + // chain is the id of the chain served by the operator. here chain_id is not used since the + // Linter complains about capitalization, which can be set with a gogoproto.custom_name but + // that is not compatible with google.api.http.get in the Query service below. + string chain = 2; } -// QueryOperatorConsKeyResponse is the response for QueryOperatorConsKeyRequest +// QueryOperatorConsKeyResponse is the response for QueryOperatorConsKeyRequest. message QueryOperatorConsKeyResponse { - // public_key is the consensus public key of the operator + // public_key is the consensus public key of the operator. tendermint.crypto.PublicKey public_key = 1 [ (gogoproto.nullable) = false ]; + // opting_out is a flag to indicate if the operator is opting out of consensus. + bool opting_out = 2; +} + +// QueryOperatorConsAddressRequest is the request to obtain the consensus address of the operator +// for a specific chain ID. +message QueryOperatorConsAddressRequest { + // operator_acc_addr is the operator account address. + string operator_acc_addr = 1; + // chain is the id of the chain served by the operator. here chain_id is not used since the + // Linter complains about capitalization, which can be set with a gogoproto.custom_name but + // that is not compatible with google.api.http.get in the Query service below. + string chain = 2; +} + +// QueryOperatorConsAddressResponse is the response for QueryOperatorConsAddressRequest. +message QueryOperatorConsAddressResponse { + // cons_addr is the consensus address corresponding to the consensus public key + // currently in use by the operator. + string cons_addr = 1; + // opting_out is a flag to indicate if the operator is opting out of consensus. + bool opting_out = 2; +} + +// QueryAllOperatorConsKeysByChainIDRequest is the request to obtain all operator addresses +// and consensus keys for a specific chain ID, with pagination. +message QueryAllOperatorConsKeysByChainIDRequest { + // chain for which the cons keys are being queried. here chain_id is not used since the + // Linter complains about capitalization, which can be set with a gogoproto.custom_name but + // that is not compatible with google.api.http.get in the Query service below. + string chain = 1; + // pagination related options. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryAllOperatorConsKeysByChainIDResponse is the response that includes a list of all operators +// and their consensus keys for a specified chain ID. +message QueryAllOperatorConsKeysByChainIDResponse { + // operator_cons_keys is a list of operator addresses and their consensus public keys. + repeated OperatorConsKeyPair operator_cons_keys = 1; + // pagination related response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// OperatorConsKeyPair holds the operator address and the consensus public key currently in +// use by the operator. +message OperatorConsKeyPair { + // operator_acc_addr is the operator account address. + string operator_acc_addr = 1; + // public_key is the consensus public key of the operator. + tendermint.crypto.PublicKey public_key = 2; + // opting_out is a flag to indicate if the operator is opting out of consensus. + bool opting_out = 3; +} + +// QueryAllOperatorConsAddrsByChainIDRequest is the request to obtain all operator addresses +// and consensus addresses for a specific chain ID, with pagination. +message QueryAllOperatorConsAddrsByChainIDRequest { + // chain for which the cons addrs are being queried. here chain_id is not used since the + // Linter complains about capitalization, which can be set with a gogoproto.custom_name but + // that is not compatible with google.api.http.get in the Query service below. + string chain = 1; + // pagination related options. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryAllOperatorConsAddrsByChainIDResponse is the response that includes a list of all operators +// and their consensus addresses for a specified chain ID. +message QueryAllOperatorConsAddrsByChainIDResponse { + // operator_cons_addrs is a list of operator account addresses and the consensus addresses. + repeated OperatorConsAddrPair operator_cons_addrs = 1; + // pagination related response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// OperatorConsAddrPair holds the operator address and the corresponding consensus address. +message OperatorConsAddrPair { + // operator_acc_addr is the operator account address. + string operator_acc_addr = 1; + // cons_addr is the consensus address corresponding to the consensus public key + // currently in use by the operator. + string cons_addr = 2; + // opting_out is a flag to indicate if the operator is opting out of consensus. + bool opting_out = 3; } // Query defines the gRPC querier service. service Query { - // OperatorInfo queries the operator information. - rpc GetOperatorInfo(GetOperatorInfoReq) returns(OperatorInfo){ - option (google.api.http).get = "/exocore/delegation/v1/GetOperatorInfo"; + // QueryOperatorInfo queries the operator information. + rpc QueryOperatorInfo(GetOperatorInfoReq) returns (OperatorInfo) { + option (google.api.http).get = "/exocore/operator/v1/operator_info/{operator_addr}"; + } + + // QueryAllOperators queries all operators. + rpc QueryAllOperators(QueryAllOperatorsRequest) returns (QueryAllOperatorsResponse) { + option (google.api.http) = { + get: "/exocore/operator/v1/all_operators" + }; } // QueryOperatorConsKeyForChainID queries the consensus public key for the operator - rpc QueryOperatorConsKeyForChainID(QueryOperatorConsKeyRequest) returns (QueryOperatorConsKeyResponse) { + rpc QueryOperatorConsKeyForChainID(QueryOperatorConsKeyRequest) returns ( + QueryOperatorConsKeyResponse + ) { option (google.api.http) = { - get: "/exocore/operator_consent/v1/GetOperatorConsKey/{addr}/{chain_id}" + get: "/exocore/operator/v1/operator_cons_key/{operator_acc_addr}/{chain}" + }; + } + + // QueryOperatorConsAddressForChainID queries the consensus address for the operator. + rpc QueryOperatorConsAddressForChainID(QueryOperatorConsAddressRequest) returns ( + QueryOperatorConsAddressResponse + ) { + option (google.api.http) = { + get: "/exocore/operator/v1/operator_cons_addr/{operator_acc_addr}/{chain}" }; } -} + // QueryAllOperatorConsKeysByChainID queries all operators and their consensus public keys + // for a specific chain ID + rpc QueryAllOperatorConsKeysByChainID(QueryAllOperatorConsKeysByChainIDRequest) returns ( + QueryAllOperatorConsKeysByChainIDResponse + ) { + option (google.api.http) = { + get: "/exocore/operator/v1/all_operator_cons_keys/{chain}" + }; + } + + // QueryAllOperatorConsAddrsByChainID queries all operators and their consensus addresses + // for a specific chain ID + rpc QueryAllOperatorConsAddrsByChainID(QueryAllOperatorConsAddrsByChainIDRequest) returns ( + QueryAllOperatorConsAddrsByChainIDResponse + ) { + option (google.api.http) = { + get: "/exocore/operator/v1/all_operator_cons_addrs/{chain}" + }; + } +} \ No newline at end of file diff --git a/proto/exocore/operator/v1/tx.proto b/proto/exocore/operator/v1/tx.proto index 3a950cc16..889a7ac4e 100644 --- a/proto/exocore/operator/v1/tx.proto +++ b/proto/exocore/operator/v1/tx.proto @@ -46,7 +46,8 @@ message OperatorInfo { string operator_meta_info = 3; // client_chain_earning_addr_list is the client chain earning address list. ClientChainEarningAddrList client_chain_earnings_addr = 4; - // commission defines the commission parameters. + // commission defines the commission parameters. it includes the time at which the commission + // was last updated. cosmos.staking.v1beta1.Commission commission = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -130,15 +131,55 @@ message RegisterOperatorReq { } // RegisterOperatorResponse is the response to a register operator request. -message RegisterOperatorResponse{} +message RegisterOperatorResponse {} -// OptInToCosmosChainRequest defines the OptInToCosmosChain request. -message OptInToCosmosChainRequest { +// OptIntoAVSReq is the request to opt into an AVS. +message OptIntoAVSReq { + option (cosmos.msg.v1.signer) = "FromAddress"; + option (amino.name) = "cosmos-sdk/OptIntoAVSReq"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // from_address is the address of the operator (sdk.AccAddress). + string from_address = 1 + [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // avs_address is the address of the AVS - either an 0x address or a chainID. + string avs_address = 2; + // optional parameter to provide the consensus key or the BLS key, depending + // on the AVS. we still have to design this fully. + string public_key = 3; +} + +// OptIntoAVSResponse is the response to a opt into an AVS request. +message OptIntoAVSResponse {} + +// OptOutOfAVSReq is the request to opt out from an AVS. +message OptOutOfAVSReq { + option (cosmos.msg.v1.signer) = "FromAddress"; + option (amino.name) = "cosmos-sdk/OptOutOfAVSReq"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // from_address is the address of the operator (sdk.AccAddress). + string from_address = 1 + [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // avs_address is the address of the AVS - either an 0x address or a chainID. + string avs_address = 2; +} + +// OptOutOfAVSResponse is the response to a opt out of an AVS request. +message OptOutOfAVSResponse {} + +// SetConsKeyReq is the request to set the operator's consensus key for a chain. +message SetConsKeyReq { option (cosmos.msg.v1.signer) = "address"; + option (amino.name) = "cosmos-sdk/SetConsKeyReq"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // address is the operator address - string address = 1; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // chain_id is the identifier for the chain that wants to opt in. - string chain_id = 2; + string chain_id = 2 [(gogoproto.customname) = "ChainID"]; // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` // there is no need to check for knowledge of the corresponding private key since this is ED25519 // and not BLS key, where a rogue key attack can take place. however, we should still check for @@ -146,22 +187,8 @@ message OptInToCosmosChainRequest { string public_key = 3; } -// OptInToCosmosChainResponse defines the OptInToCosmosChain response. -message OptInToCosmosChainResponse { -} - -// InitOptOutFromCosmosChainRequest defines the InitOptOutFromCosmosChain request. -message InitOptOutFromCosmosChainRequest { - option (cosmos.msg.v1.signer) = "address"; - // address is the operator address - string address = 1; - // chain_id is the identifier for the chain that wants to opt out. - string chain_id = 2; -} - -// InitOptOutFromCosmosChainResponse defines the InitOptOutFromCosmosChain response. -message InitOptOutFromCosmosChainResponse { -} +// SetConsKeyResponse is the response to SetConsKeyReq. +message SetConsKeyResponse {} // Msg defines the operator Msg service. service Msg { @@ -169,15 +196,13 @@ service Msg { // RegisterOperator registers a new operator. rpc RegisterOperator(RegisterOperatorReq) returns (RegisterOperatorResponse); - // add services for dogfood - // OptInToCosmosChain acts as opt in method for an operator to - // start validatring on a chain. The operator must sign the request with - // the key with which they registered in the system. - rpc OptInToCosmosChain(OptInToCosmosChainRequest) returns (OptInToCosmosChainResponse) {}; - // InitOptOutFromCosmosChain is a method with which an operator can initiate - // the opt out process from a chain. The operator must sign the request with - // the key with which they registered in the system. The opt-out process takes - // as long as the chain's unbonding period to complete, plus some loose change - // for message relaying across chains. - rpc InitOptOutFromCosmosChain(InitOptOutFromCosmosChainRequest) returns (InitOptOutFromCosmosChainResponse) {}; + // SetConsKey sets the operator's consensus key for a chain. To do this, the operator + // must have previously opted into the chain. + // TODO; rationalize this with non-chain AVSs wherein other keys can be set. + rpc SetConsKey(SetConsKeyReq) returns (SetConsKeyResponse) {}; + + // OptIntoAVS opts an operator into an AVS. + rpc OptIntoAVS(OptIntoAVSReq) returns (OptIntoAVSResponse); + // OptOutOfAVS opts an operator out of an AVS. + rpc OptOutOfAVS(OptOutOfAVSReq) returns (OptOutOfAVSResponse); } \ No newline at end of file diff --git a/proto/exocore/oracle/info.proto b/proto/exocore/oracle/info.proto index f3ddcb875..cb89daccb 100644 --- a/proto/exocore/oracle/info.proto +++ b/proto/exocore/oracle/info.proto @@ -17,14 +17,16 @@ message Chain{ message Token{ // token name string name = 1; - //id refer to chainList's index + // id refer to chainList's index uint64 chain_id = 2 [(gogoproto.customname) = "ChainID"]; - //if any, like erc20 tokens + // if any, like erc20 tokens string contract_address = 3; // decimal of token price int32 decimal = 4; - //set false when we stop official price oracle service for a specified token + // set false when we stop official price oracle service for a specified token bool active = 5; + // refer to assetID from assets module if exists + string asset_id = 6 [(gogoproto.customname) = "AssetID"]; } // Endpoint tells where to fetch the price info diff --git a/proto/exocore/oracle/params.proto b/proto/exocore/oracle/params.proto index d2c4a3f95..4cf0111b0 100644 --- a/proto/exocore/oracle/params.proto +++ b/proto/exocore/oracle/params.proto @@ -20,4 +20,14 @@ message Params { repeated RuleSource rules = 4; // each tokenFeeder represents an active token whose price being updated repeated TokenFeeder token_feeders = 5; + // for each round allow at most max_nonce transactions to be sent by one validator, [1,max_nonce] + int32 max_nonce = 6; + // voting power need to reach more than threshold_a/threshold_b + int32 threshold_a = 7; + // voting power need to reach more than threshold_a/threshold_b + int32 threshold_b = 8; + // for v1, mode=1, get final price as soon as voting power reach threshold_a/threshold_b + int32 mode = 9; + // for each round, a validator only allowed to provide at most max_det_id continuos rounds of prices for DS + int32 max_det_id = 10; } diff --git a/testutil/utils.go b/testutil/utils.go index d387efbb9..a1ad89754 100644 --- a/testutil/utils.go +++ b/testutil/utils.go @@ -229,6 +229,8 @@ func (suite *BaseTestSuite) SetupWithGenesisValSet(genAccs []authtypes.GenesisAc delegationGenesis := delegationtypes.NewGenesis(delegationsByStaker) genesisState[delegationtypes.ModuleName] = app.AppCodec().MustMarshalJSON(delegationGenesis) + // create a dogfood genesis with just the validator set, that is, the bare + // minimum valid genesis required to start a chain. dogfoodGenesis := dogfoodtypes.NewGenesis( dogfoodtypes.DefaultParams(), []dogfoodtypes.GenesisValidator{ { @@ -236,10 +238,14 @@ func (suite *BaseTestSuite) SetupWithGenesisValSet(genAccs []authtypes.GenesisAc Power: 1, }, { - PublicKey: hexutil.Encode(pubKey.Bytes()), + PublicKey: hexutil.Encode(pubKey2.Bytes()), Power: 1, }, }, + []dogfoodtypes.EpochToOperatorAddrs{}, + []dogfoodtypes.EpochToConsensusAddrs{}, + []dogfoodtypes.EpochToUndelegationRecordKeys{}, + math.NewInt(2), // must match total vote power ) genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis) diff --git a/utils/utils.go b/utils/utils.go index 2e8537020..70e768118 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -100,7 +100,7 @@ func DecodeHexString(hexString string) ([]byte, error) { return hex.DecodeString(hexString) } -func ProcessAvsAddress(address string) (string, error) { +func ProcessAddress(address string) (string, error) { switch { case strings.HasPrefix(address, "0x"): avsAddressHex, err := DecodeHexString(address) diff --git a/x/assets/client/cli/query.go b/x/assets/client/cli/query.go index e3455d62b..0a50e8b76 100644 --- a/x/assets/client/cli/query.go +++ b/x/assets/client/cli/query.go @@ -4,12 +4,14 @@ import ( "context" "fmt" "strconv" + "strings" errorsmod "cosmossdk.io/errors" "github.com/ExocoreNetwork/exocore/x/assets/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" ) @@ -33,7 +35,6 @@ func GetQueryCmd() *cobra.Command { QueStakerSpecifiedAssetAmount(), QueOperatorAssetInfos(), QueOperatorSpecifiedAssetAmount(), - // QueStakerExoCoreAddr(), ) return cmd } @@ -148,7 +149,7 @@ func QueStakingAssetInfo() *cobra.Command { _, assetID := types.GetStakeIDAndAssetIDFromStr(clientChainLzID, "", args[0]) queryClient := types.NewQueryClient(clientCtx) req := &types.QueryStakingAssetInfo{ - AssetID: assetID, + AssetID: assetID, // already lowercase } res, err := queryClient.QueStakingAssetInfo(context.Background(), req) if err != nil { @@ -202,9 +203,14 @@ func QueStakerAssetInfos() *cobra.Command { return err } + stakerID := args[0] + if _, _, err := types.ValidateID(stakerID, false, false); err != nil { + return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error()) + } + queryClient := types.NewQueryClient(clientCtx) req := &types.QueryStakerAssetInfo{ - StakerID: args[0], + StakerID: strings.ToLower(stakerID), } res, err := queryClient.QueStakerAssetInfos(context.Background(), req) if err != nil { @@ -238,8 +244,8 @@ func QueStakerSpecifiedAssetAmount() *cobra.Command { } stakerID, assetID := types.GetStakeIDAndAssetIDFromStr(clientChainLzID, args[1], args[2]) req := &types.QuerySpecifiedAssetAmountReq{ - StakerID: stakerID, - AssetID: assetID, + StakerID: stakerID, // already lowercase + AssetID: assetID, // already lowercase } res, err := queryClient.QueStakerSpecifiedAssetAmount(context.Background(), req) if err != nil { @@ -267,8 +273,12 @@ func QueOperatorAssetInfos() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) + accAddr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error()) + } req := &types.QueryOperatorAssetInfos{ - OperatorAddr: args[0], + OperatorAddr: accAddr.String(), // already lowercase } res, err := queryClient.QueOperatorAssetInfos(context.Background(), req) if err != nil { @@ -300,41 +310,16 @@ func QueOperatorSpecifiedAssetAmount() *cobra.Command { return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error()) } _, assetID := types.GetStakeIDAndAssetIDFromStr(clientChainLzID, "", args[2]) - queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryOperatorSpecifiedAssetAmountReq{ - OperatorAddr: args[0], - AssetID: assetID, - } - res, err := queryClient.QueOperatorSpecifiedAssetAmount(context.Background(), req) - if err != nil { - return err - } - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -// QueStakerExoCoreAddr queries staker ExoCore address -func QueStakerExoCoreAddr() *cobra.Command { - cmd := &cobra.Command{ - Use: "QueStakerExoCoreAddr stakerID", - Short: "Get staker ExoCore address", - Long: "Get staker ExoCore address", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) + accAddr, err := sdk.AccAddressFromBech32(args[0]) if err != nil { - return err + return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error()) } - queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryStakerExCoreAddr{ - Staker: args[0], + req := &types.QueryOperatorSpecifiedAssetAmountReq{ + OperatorAddr: accAddr.String(), // already lowercase + AssetID: assetID, // already lowercase } - res, err := queryClient.QueStakerExoCoreAddr(context.Background(), req) + res, err := queryClient.QueOperatorSpecifiedAssetAmount(context.Background(), req) if err != nil { return err } diff --git a/x/assets/keeper/app_chain.go b/x/assets/keeper/app_chain.go deleted file mode 100644 index dd000ecd4..000000000 --- a/x/assets/keeper/app_chain.go +++ /dev/null @@ -1,71 +0,0 @@ -package keeper - -import ( - "strings" - - assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// SetAppChainInfo stores the info for the app chain to the db. At the moment, it is called by -// the genesis process. In the future, it should be called by governance. -func (k Keeper) SetAppChainInfo( - ctx sdk.Context, - info *assetstype.AppChainInfo, -) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), assetstype.KeyPrefixAppChainInfo) - bz := k.cdc.MustMarshal(info) - store.Set([]byte(info.ChainID), bz) -} - -// AppChainInfoIsExist returns whether the app chain info for the specified chainID exists -func (k Keeper) AppChainInfoIsExist(ctx sdk.Context, chainID string) bool { - // short circuit if information is for the current chain - if strings.Compare(chainID, ctx.ChainID()) == 0 { - return true - } - store := prefix.NewStore(ctx.KVStore(k.storeKey), assetstype.KeyPrefixAppChainInfo) - return store.Has([]byte(chainID)) -} - -// GetAppChainInfoByChainID gets the app chain info for the specified chainID, if it exists -func (k Keeper) GetAppChainInfoByChainID( - ctx sdk.Context, - chainID string, -) (info *assetstype.AppChainInfo, err error) { - // short circuit if information is for the current chain - if strings.Compare(chainID, ctx.ChainID()) == 0 { - return &assetstype.AppChainInfo{ - ChainID: ctx.ChainID(), - }, nil - } - store := prefix.NewStore(ctx.KVStore(k.storeKey), assetstype.KeyPrefixAppChainInfo) - value := store.Get([]byte(chainID)) - if value == nil { - return nil, assetstype.ErrUnknownAppChainID - } - ret := &assetstype.AppChainInfo{} - k.cdc.MustUnmarshal(value, ret) - return ret, nil -} - -// GetAllAppChainInfo gets all the app chain info, indexed by chainID -func (k Keeper) GetAllAppChainInfo( - ctx sdk.Context, -) (infos map[string]*assetstype.AppChainInfo) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, assetstype.KeyPrefixAppChainInfo) - defer iterator.Close() - - ret := make(map[string]*assetstype.AppChainInfo, 0) - for ; iterator.Valid(); iterator.Next() { - chainInfo := &assetstype.AppChainInfo{} - k.cdc.MustUnmarshal(iterator.Value(), chainInfo) - ret[chainInfo.ChainID] = chainInfo - } - ret[ctx.ChainID()] = &assetstype.AppChainInfo{ - ChainID: ctx.ChainID(), - } - return ret -} diff --git a/x/assets/keeper/client_chain.go b/x/assets/keeper/client_chain.go index 667a33386..b3c53c5e2 100644 --- a/x/assets/keeper/client_chain.go +++ b/x/assets/keeper/client_chain.go @@ -18,7 +18,7 @@ func (k Keeper) SetClientChainInfo(ctx sdk.Context, info *assetstype.ClientChain return nil } -func (k Keeper) IsExistedClientChain(ctx sdk.Context, index uint64) bool { +func (k Keeper) ClientChainExists(ctx sdk.Context, index uint64) bool { store := prefix.NewStore(ctx.KVStore(k.storeKey), assetstype.KeyPrefixClientChainInfo) return store.Has([]byte(hexutil.EncodeUint64(index))) } diff --git a/x/assets/keeper/grpc_query.go b/x/assets/keeper/grpc_query.go index 40b20fb87..b486b3fc0 100644 --- a/x/assets/keeper/grpc_query.go +++ b/x/assets/keeper/grpc_query.go @@ -93,13 +93,3 @@ func (k Keeper) QueOperatorSpecifiedAssetAmount(ctx context.Context, req *assets } return k.GetOperatorSpecifiedAssetInfo(c, addr, req.AssetID) } - -// QueStakerExoCoreAddr outdated,will be deprecated -func (k Keeper) QueStakerExoCoreAddr(ctx context.Context, req *assetstype.QueryStakerExCoreAddr) (*assetstype.QueryStakerExCoreAddrResponse, error) { - c := sdk.UnwrapSDKContext(ctx) - exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.Staker) - if err != nil { - return nil, err - } - return &assetstype.QueryStakerExCoreAddrResponse{ExoCoreAddr: exoCoreAddr}, nil -} diff --git a/x/assets/types/errors.go b/x/assets/types/errors.go index 3c6d59ec3..d7670b0d0 100644 --- a/x/assets/types/errors.go +++ b/x/assets/types/errors.go @@ -47,38 +47,32 @@ var ( ) ErrInvalidOperatorAddr = errorsmod.Register( - ModuleName, - 8, + ModuleName, 8, "the operator address isn't a valid account address", ) - ErrUnknownAppChainID = errorsmod.Register( - ModuleName, 9, - "the app chain id is unknown or invalid", - ) - ErrInvalidEvmAddressFormat = errorsmod.Register( - ModuleName, 10, + ModuleName, 9, "the evm address format is error", ) ErrInvalidLzUaTopicIDLength = errorsmod.Register( - ModuleName, 11, + ModuleName, 10, "the LZUaTopicID length isn't equal to HashLength", ) ErrNoParamsKey = errorsmod.Register( - ModuleName, 12, + ModuleName, 11, "there is no stored key for deposit module params", ) ErrNotEqualToLzAppAddr = errorsmod.Register( - ModuleName, 13, + ModuleName, 12, "the address isn't equal to the layerZero gateway address", ) ErrInvalidGenesisData = errorsmod.Register( - ModuleName, 14, + ModuleName, 13, "the genesis data supplied is invalid", ) diff --git a/x/assets/types/genesis.go b/x/assets/types/genesis.go index 4f3342067..693cc43a6 100644 --- a/x/assets/types/genesis.go +++ b/x/assets/types/genesis.go @@ -42,6 +42,7 @@ func (gs GenesisState) Validate() error { i, ) } + // this is our primary method of cross-chain communication. if info.LayerZeroChainID == 0 { return errorsmod.Wrapf( ErrInvalidGenesisData, @@ -49,6 +50,15 @@ func (gs GenesisState) Validate() error { info.Name, ) } + // the address length is used to convert from bytes32 to address. + if info.AddressLength == 0 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "nil AddressLength for chain %s", + info.Name, + ) + } + // check for no duplicated chain, indexed by LayerZeroChainID. if _, ok := lzIDs[info.LayerZeroChainID]; ok { return errorsmod.Wrapf( ErrInvalidGenesisData, @@ -136,7 +146,7 @@ func (gs GenesisState) Validate() error { // validate the stakerID var stakerClientChainID uint64 var err error - if _, stakerClientChainID, err = ValidateID(stakerID, true); err != nil { + if _, stakerClientChainID, err = ValidateID(stakerID, true, true); err != nil { return errorsmod.Wrapf( ErrInvalidGenesisData, "invalid stakerID: %s", diff --git a/x/assets/types/genesis_test.go b/x/assets/types/genesis_test.go index 4072d644b..4505071ce 100644 --- a/x/assets/types/genesis_test.go +++ b/x/assets/types/genesis_test.go @@ -108,6 +108,38 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { }, expPass: false, }, + { + name: "invalid genesis due to zero layer zero chain id", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + ClientChains: []types.ClientChainInfo{ + ethClientChain, + }, + }, + malleate: func(gs *types.GenesisState) { + gs.ClientChains[0].LayerZeroChainID = 0 + }, + unmalleate: func(gs *types.GenesisState) { + gs.ClientChains[0].LayerZeroChainID = 101 + }, + expPass: false, + }, + { + name: "invalid genesis due to zero address length", + genState: &types.GenesisState{ + Params: types.DefaultParams(), + ClientChains: []types.ClientChainInfo{ + ethClientChain, + }, + }, + malleate: func(gs *types.GenesisState) { + gs.ClientChains[0].AddressLength = 0 + }, + unmalleate: func(gs *types.GenesisState) { + gs.ClientChains[0].AddressLength = 20 + }, + expPass: false, + }, { name: "invalid genesis due to missing client chain", genState: &types.GenesisState{ diff --git a/x/assets/types/keys.go b/x/assets/types/keys.go index 80deb1948..f0acdbbab 100644 --- a/x/assets/types/keys.go +++ b/x/assets/types/keys.go @@ -32,7 +32,6 @@ func init() { // prefix bytes for the reStaking assets manage store const ( prefixClientChainInfo = iota + 1 - prefixAppChainInfo prefixRestakingAssetInfo prefixRestakerAssetInfo prefixOperatorAssetInfo @@ -50,8 +49,6 @@ var ( // KeyPrefixClientChainInfo key->value: chainIndex->ClientChainInfo KeyPrefixClientChainInfo = []byte{prefixClientChainInfo} - KeyPrefixAppChainInfo = []byte{prefixAppChainInfo} - // KeyPrefixReStakingAssetInfo AssetID = AssetAddr+'_'+chainIndex // KeyPrefixReStakingAssetInfo key->value: AssetID-> StakingAssetInfo // the `_` will only be used as a separated character for the stakerID and assetID @@ -127,9 +124,8 @@ func ParseID(key string) (string, uint64, error) { return keys[0], id, nil } -func ValidateID(key string, validateEth bool) (string, uint64, error) { - // check lowercase - if key != strings.ToLower(key) { +func ValidateID(key string, checkLowercase bool, validateEth bool) (string, uint64, error) { + if checkLowercase && key != strings.ToLower(key) { return "", 0, errorsmod.Wrapf(ErrParseAssetsStateKey, "ID not lowercase: %s", key) } // parse it diff --git a/x/assets/types/query.pb.go b/x/assets/types/query.pb.go index 2ca380f32..0dbd48e4f 100644 --- a/x/assets/types/query.pb.go +++ b/x/assets/types/query.pb.go @@ -788,74 +788,72 @@ func init() { func init() { proto.RegisterFile("exocore/assets/v1/query.proto", fileDescriptor_1de33a8cf38ccb9d) } var fileDescriptor_1de33a8cf38ccb9d = []byte{ - // 1067 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xb8, 0x34, 0x4d, 0xc6, 0xa9, 0x80, 0xa9, 0x49, 0xed, 0x4d, 0x6b, 0xa7, 0x4b, 0x49, - 0x5c, 0x2b, 0xec, 0x26, 0x2e, 0x28, 0x4d, 0xa5, 0x0a, 0x39, 0x69, 0x24, 0x52, 0xa4, 0x02, 0xee, - 0x05, 0xf5, 0x62, 0x6d, 0x77, 0x27, 0xee, 0x12, 0x67, 0xc7, 0xd9, 0x59, 0x07, 0x1b, 0x84, 0x84, - 0x90, 0x90, 0xb8, 0x20, 0x55, 0xe2, 0xd4, 0x0b, 0x17, 0xce, 0x20, 0x10, 0x88, 0x2b, 0x57, 0x8e, - 0x15, 0x1c, 0xe0, 0x14, 0x21, 0x07, 0x89, 0x03, 0x7f, 0x02, 0x79, 0x66, 0xbc, 0x5e, 0xef, 0xce, - 0x38, 0x9b, 0xe6, 0xe6, 0x9d, 0xef, 0xcd, 0x7b, 0xdf, 0x7c, 0xef, 0xed, 0x7c, 0x6b, 0x78, 0x15, - 0x77, 0x89, 0x4d, 0x7c, 0x6c, 0x5a, 0x94, 0xe2, 0x80, 0x9a, 0x87, 0x6b, 0x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0xec, 0x9b, 0xdb, 0x3c, 0xeb, 0x7d, 0x1c, 0x7c, 0x44, 0xfc, 0xbd, 0xb0, - 0x48, 0x77, 0x58, 0x26, 0xe8, 0xb5, 0x31, 0x7d, 0x34, 0xcd, 0xfe, 0x49, 0xde, 0xfc, 0x3f, 0x00, - 0x00, 0xff, 0xff, 0xbc, 0x9b, 0x07, 0xd7, 0x25, 0x0f, 0x00, 0x00, + // 1036 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x18, 0xcd, 0xb8, 0x34, 0x4d, 0x66, 0x83, 0x80, 0xa9, 0x49, 0xed, 0x4d, 0x6b, 0xa7, 0x4b, 0x49, + 0x5c, 0x2b, 0xec, 0x36, 0x2e, 0x28, 0x4d, 0xa5, 0x0a, 0x39, 0x69, 0x24, 0x52, 0xa4, 0x02, 0xee, + 0x05, 0xf5, 0x62, 0x6d, 0x77, 0x27, 0xee, 0x12, 0x67, 0xc7, 0xd9, 0x59, 0x07, 0x9b, 0x13, 0x42, + 0x42, 0xe2, 0x82, 0x54, 0x89, 0x53, 0x2f, 0x5c, 0xb8, 0x23, 0x24, 0x10, 0x57, 0xae, 0x1c, 0x2b, + 0x38, 0xc0, 0x29, 0x42, 0x0e, 0x12, 0x07, 0xfe, 0x02, 0x6e, 0xc8, 0x33, 0x63, 0xef, 0x7a, 0x77, + 0xc6, 0xd9, 0xb4, 0xb7, 0xec, 0xbc, 0xef, 0xc7, 0xdb, 0xf7, 0x7d, 0x3b, 0xcf, 0x81, 0x57, 0x70, + 0x8f, 0x38, 0x24, 0xc0, 0x96, 0x4d, 0x29, 0x0e, 0xa9, 0x75, 0xb4, 0x6e, 0x1d, 0x76, 0x71, 0xd0, + 0x37, 0x3b, 0x01, 0x09, 0x09, 0x7a, 0x4d, 0xc0, 0x26, 0x87, 0xcd, 0xa3, 0x75, 0x7d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c6, 0x46, 0x44, 0x7a, 0x0d, 0x55, 0x95, 0x92, 0xa6, 0xc9, 0x7d, 0x1b, 0x89, + 0x8a, 0xe3, 0x26, 0xb0, 0x3a, 0x4d, 0xd4, 0x58, 0xa4, 0x7e, 0x3d, 0xb3, 0xcb, 0x66, 0x56, 0x76, + 0x82, 0xc8, 0x8f, 0x80, 0x5d, 0x50, 0xfc, 0x5c, 0x76, 0xb9, 0x22, 0x4b, 0x49, 0x55, 0x7e, 0x15, + 0xeb, 0x19, 0xdc, 0xd9, 0xb8, 0x13, 0x71, 0xad, 0xa1, 0x1b, 0xd3, 0xb8, 0x4a, 0x39, 0x89, 0x8f, + 0x4b, 0xe2, 0xae, 0xd5, 0xec, 0x2e, 0xa7, 0xfe, 0xb8, 0xd4, 0x8e, 0x98, 0xe9, 0xe3, 0x92, 0xd0, + 0xfa, 0x85, 0xbb, 0xf6, 0x34, 0x17, 0x43, 0x1b, 0xa7, 0xd1, 0x51, 0x09, 0x9e, 0xc9, 0x55, 0x5f, + 0x50, 0xf2, 0xad, 0x7b, 0xbf, 0x0e, 0x4a, 0xe0, 0xd9, 0xa0, 0x04, 0xfe, 0x1a, 0x94, 0xc0, 0x93, + 0x93, 0xd2, 0xcc, 0xb3, 0x93, 0xd2, 0xcc, 0x9f, 0x27, 0xa5, 0x99, 0x87, 0x37, 0x5a, 0x5e, 0xf8, + 0xb8, 0xfb, 0xc8, 0x74, 0xc8, 0x81, 0xb5, 0xc3, 0xab, 0xde, 0xc7, 0xe1, 0xa7, 0x24, 0xd8, 0x1f, + 0x37, 0xe9, 0x8d, 0xda, 0x84, 0xfd, 0x0e, 0xa6, 0x8f, 0x66, 0xd9, 0x7f, 0x65, 0x37, 0xff, 0x0f, + 0x00, 0x00, 0xff, 0xff, 0x8b, 0x2c, 0x0c, 0x87, 0x71, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -888,8 +886,6 @@ type QueryClient interface { QueOperatorAssetInfos(ctx context.Context, in *QueryOperatorAssetInfos, opts ...grpc.CallOption) (*QueryOperatorAssetInfosResponse, error) // OperatorSpecifiedAssetAmount queries the operator specified asset amount. QueOperatorSpecifiedAssetAmount(ctx context.Context, in *QueryOperatorSpecifiedAssetAmountReq, opts ...grpc.CallOption) (*OperatorAssetInfo, error) - // StakerExCoreAddr queries the staker exocore address. - QueStakerExoCoreAddr(ctx context.Context, in *QueryStakerExCoreAddr, opts ...grpc.CallOption) (*QueryStakerExCoreAddrResponse, error) } type queryClient struct { @@ -981,15 +977,6 @@ func (c *queryClient) QueOperatorSpecifiedAssetAmount(ctx context.Context, in *Q return out, nil } -func (c *queryClient) QueStakerExoCoreAddr(ctx context.Context, in *QueryStakerExCoreAddr, opts ...grpc.CallOption) (*QueryStakerExCoreAddrResponse, error) { - out := new(QueryStakerExCoreAddrResponse) - err := c.cc.Invoke(ctx, "/exocore.assets.v1.Query/QueStakerExoCoreAddr", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. type QueryServer interface { // Params retrieves the assets module params @@ -1010,8 +997,6 @@ type QueryServer interface { QueOperatorAssetInfos(context.Context, *QueryOperatorAssetInfos) (*QueryOperatorAssetInfosResponse, error) // OperatorSpecifiedAssetAmount queries the operator specified asset amount. QueOperatorSpecifiedAssetAmount(context.Context, *QueryOperatorSpecifiedAssetAmountReq) (*OperatorAssetInfo, error) - // StakerExCoreAddr queries the staker exocore address. - QueStakerExoCoreAddr(context.Context, *QueryStakerExCoreAddr) (*QueryStakerExCoreAddrResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1045,9 +1030,6 @@ func (*UnimplementedQueryServer) QueOperatorAssetInfos(ctx context.Context, req func (*UnimplementedQueryServer) QueOperatorSpecifiedAssetAmount(ctx context.Context, req *QueryOperatorSpecifiedAssetAmountReq) (*OperatorAssetInfo, error) { return nil, status.Errorf(codes.Unimplemented, "method QueOperatorSpecifiedAssetAmount not implemented") } -func (*UnimplementedQueryServer) QueStakerExoCoreAddr(ctx context.Context, req *QueryStakerExCoreAddr) (*QueryStakerExCoreAddrResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueStakerExoCoreAddr not implemented") -} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1215,24 +1197,6 @@ func _Query_QueOperatorSpecifiedAssetAmount_Handler(srv interface{}, ctx context return interceptor(ctx, in, info, handler) } -func _Query_QueStakerExoCoreAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryStakerExCoreAddr) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueStakerExoCoreAddr(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/exocore.assets.v1.Query/QueStakerExoCoreAddr", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueStakerExoCoreAddr(ctx, req.(*QueryStakerExCoreAddr)) - } - return interceptor(ctx, in, info, handler) -} - var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "exocore.assets.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1273,10 +1237,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueOperatorSpecifiedAssetAmount", Handler: _Query_QueOperatorSpecifiedAssetAmount_Handler, }, - { - MethodName: "QueStakerExoCoreAddr", - Handler: _Query_QueStakerExoCoreAddr_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/assets/v1/query.proto", diff --git a/x/assets/types/query.pb.gw.go b/x/assets/types/query.pb.gw.go index 507e99040..7e0b349bc 100644 --- a/x/assets/types/query.pb.gw.go +++ b/x/assets/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -301,69 +303,17 @@ func local_request_Query_QueOperatorSpecifiedAssetAmount_0(ctx context.Context, } -func request_Query_QueStakerExoCoreAddr_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryStakerExCoreAddr - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["staker"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "staker") - } - - protoReq.Staker, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "staker", err) - } - - msg, err := client.QueStakerExoCoreAddr(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_QueStakerExoCoreAddr_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryStakerExCoreAddr - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["staker"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "staker") - } - - protoReq.Staker, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "staker", err) - } - - msg, err := server.QueStakerExoCoreAddr(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -371,6 +321,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -384,6 +335,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueClientChainInfoByIndex_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -391,6 +344,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueClientChainInfoByIndex_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -404,6 +358,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueAllClientChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -411,6 +367,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueAllClientChainInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -424,6 +381,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueStakingAssetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -431,6 +390,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueStakingAssetInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -444,6 +404,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueAllStakingAssetsInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -451,6 +413,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueAllStakingAssetsInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -464,6 +427,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueStakerAssetInfos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -471,6 +436,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueStakerAssetInfos_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -484,6 +450,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueStakerSpecifiedAssetAmount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -491,6 +459,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueStakerSpecifiedAssetAmount_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -504,6 +473,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueOperatorAssetInfos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -511,6 +482,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueOperatorAssetInfos_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -524,6 +496,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueOperatorSpecifiedAssetAmount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -531,6 +505,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueOperatorSpecifiedAssetAmount_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -541,26 +516,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_QueStakerExoCoreAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_QueStakerExoCoreAddr_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_QueStakerExoCoreAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -782,26 +737,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_QueStakerExoCoreAddr_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_QueStakerExoCoreAddr_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_QueStakerExoCoreAddr_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -823,8 +758,6 @@ var ( pattern_Query_QueOperatorAssetInfos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "assets", "v1", "QueOperatorAssetInfos"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueOperatorSpecifiedAssetAmount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "assets", "v1", "QueStakerSpecifiedAssetAmount"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_QueStakerExoCoreAddr_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "assets", "v1", "QueStakerExoCoreAddr", "staker"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -845,6 +778,4 @@ var ( forward_Query_QueOperatorAssetInfos_0 = runtime.ForwardResponseMessage forward_Query_QueOperatorSpecifiedAssetAmount_0 = runtime.ForwardResponseMessage - - forward_Query_QueStakerExoCoreAddr_0 = runtime.ForwardResponseMessage ) diff --git a/x/assets/types/tx.pb.go b/x/assets/types/tx.pb.go index ad76873f0..afaa7deda 100644 --- a/x/assets/types/tx.pb.go +++ b/x/assets/types/tx.pb.go @@ -181,81 +181,6 @@ func (m *ClientChainInfo) GetAddressLength() uint32 { return 0 } -// AppChainInfo is used to store information related to the subscriber app chains we validate. -// The information stored within this module consists only of the chain's identifiers. -// The validation-related information is stored in the coordinator module. -type AppChainInfo struct { - // name of the chain, for example "ethereum" - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // meta_info is at Exocore's discretion to deter,ome - MetaInfo string `protobuf:"bytes,2,opt,name=meta_info,json=metaInfo,proto3" json:"meta_info,omitempty"` - // chain_id is used as the primary key - ChainID string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - // exocore_chain_index is the index of the chain in exocore, so far unused - ExocoreChainIndex uint64 `protobuf:"varint,4,opt,name=exocore_chain_index,json=exocoreChainIndex,proto3" json:"exocore_chain_index,omitempty"` -} - -func (m *AppChainInfo) Reset() { *m = AppChainInfo{} } -func (m *AppChainInfo) String() string { return proto.CompactTextString(m) } -func (*AppChainInfo) ProtoMessage() {} -func (*AppChainInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{2} -} -func (m *AppChainInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AppChainInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AppChainInfo.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AppChainInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_AppChainInfo.Merge(m, src) -} -func (m *AppChainInfo) XXX_Size() int { - return m.Size() -} -func (m *AppChainInfo) XXX_DiscardUnknown() { - xxx_messageInfo_AppChainInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_AppChainInfo proto.InternalMessageInfo - -func (m *AppChainInfo) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *AppChainInfo) GetMetaInfo() string { - if m != nil { - return m.MetaInfo - } - return "" -} - -func (m *AppChainInfo) GetChainID() string { - if m != nil { - return m.ChainID - } - return "" -} - -func (m *AppChainInfo) GetExocoreChainIndex() uint64 { - if m != nil { - return m.ExocoreChainIndex - } - return 0 -} - // AssetInfo defines the information for an asset to be used in staking. type AssetInfo struct { // name of the asset, like "Tether USD" @@ -280,7 +205,7 @@ func (m *AssetInfo) Reset() { *m = AssetInfo{} } func (m *AssetInfo) String() string { return proto.CompactTextString(m) } func (*AssetInfo) ProtoMessage() {} func (*AssetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{3} + return fileDescriptor_adb6ebd423a2c426, []int{2} } func (m *AssetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -370,7 +295,7 @@ func (m *StakingAssetInfo) Reset() { *m = StakingAssetInfo{} } func (m *StakingAssetInfo) String() string { return proto.CompactTextString(m) } func (*StakingAssetInfo) ProtoMessage() {} func (*StakingAssetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{4} + return fileDescriptor_adb6ebd423a2c426, []int{3} } func (m *StakingAssetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -422,7 +347,7 @@ func (m *StakerAssetInfo) Reset() { *m = StakerAssetInfo{} } func (m *StakerAssetInfo) String() string { return proto.CompactTextString(m) } func (*StakerAssetInfo) ProtoMessage() {} func (*StakerAssetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{5} + return fileDescriptor_adb6ebd423a2c426, []int{4} } func (m *StakerAssetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -462,7 +387,7 @@ func (m *StakerAllAssetsInfo) Reset() { *m = StakerAllAssetsInfo{} } func (m *StakerAllAssetsInfo) String() string { return proto.CompactTextString(m) } func (*StakerAllAssetsInfo) ProtoMessage() {} func (*StakerAllAssetsInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{6} + return fileDescriptor_adb6ebd423a2c426, []int{5} } func (m *StakerAllAssetsInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -524,7 +449,7 @@ func (m *OperatorAssetInfo) Reset() { *m = OperatorAssetInfo{} } func (m *OperatorAssetInfo) String() string { return proto.CompactTextString(m) } func (*OperatorAssetInfo) ProtoMessage() {} func (*OperatorAssetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{7} + return fileDescriptor_adb6ebd423a2c426, []int{6} } func (m *OperatorAssetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -573,7 +498,7 @@ func (m *MsgSetExoCoreAddr) Reset() { *m = MsgSetExoCoreAddr{} } func (m *MsgSetExoCoreAddr) String() string { return proto.CompactTextString(m) } func (*MsgSetExoCoreAddr) ProtoMessage() {} func (*MsgSetExoCoreAddr) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{8} + return fileDescriptor_adb6ebd423a2c426, []int{7} } func (m *MsgSetExoCoreAddr) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -611,7 +536,7 @@ func (m *MsgSetExoCoreAddrResponse) Reset() { *m = MsgSetExoCoreAddrResp func (m *MsgSetExoCoreAddrResponse) String() string { return proto.CompactTextString(m) } func (*MsgSetExoCoreAddrResponse) ProtoMessage() {} func (*MsgSetExoCoreAddrResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{9} + return fileDescriptor_adb6ebd423a2c426, []int{8} } func (m *MsgSetExoCoreAddrResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -652,7 +577,7 @@ func (m *RegisterClientChainReq) Reset() { *m = RegisterClientChainReq{} func (m *RegisterClientChainReq) String() string { return proto.CompactTextString(m) } func (*RegisterClientChainReq) ProtoMessage() {} func (*RegisterClientChainReq) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{10} + return fileDescriptor_adb6ebd423a2c426, []int{9} } func (m *RegisterClientChainReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -689,7 +614,7 @@ func (m *RegisterClientChainResponse) Reset() { *m = RegisterClientChain func (m *RegisterClientChainResponse) String() string { return proto.CompactTextString(m) } func (*RegisterClientChainResponse) ProtoMessage() {} func (*RegisterClientChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{11} + return fileDescriptor_adb6ebd423a2c426, []int{10} } func (m *RegisterClientChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -731,7 +656,7 @@ func (m *RegisterAssetReq) Reset() { *m = RegisterAssetReq{} } func (m *RegisterAssetReq) String() string { return proto.CompactTextString(m) } func (*RegisterAssetReq) ProtoMessage() {} func (*RegisterAssetReq) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{12} + return fileDescriptor_adb6ebd423a2c426, []int{11} } func (m *RegisterAssetReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -768,7 +693,7 @@ func (m *RegisterAssetResponse) Reset() { *m = RegisterAssetResponse{} } func (m *RegisterAssetResponse) String() string { return proto.CompactTextString(m) } func (*RegisterAssetResponse) ProtoMessage() {} func (*RegisterAssetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{13} + return fileDescriptor_adb6ebd423a2c426, []int{12} } func (m *RegisterAssetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -810,7 +735,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{14} + return fileDescriptor_adb6ebd423a2c426, []int{13} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -862,7 +787,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_adb6ebd423a2c426, []int{15} + return fileDescriptor_adb6ebd423a2c426, []int{14} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -894,7 +819,6 @@ var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { proto.RegisterType((*ValueField)(nil), "exocore.assets.v1.ValueField") proto.RegisterType((*ClientChainInfo)(nil), "exocore.assets.v1.ClientChainInfo") - proto.RegisterType((*AppChainInfo)(nil), "exocore.assets.v1.AppChainInfo") proto.RegisterType((*AssetInfo)(nil), "exocore.assets.v1.AssetInfo") proto.RegisterType((*StakingAssetInfo)(nil), "exocore.assets.v1.StakingAssetInfo") proto.RegisterType((*StakerAssetInfo)(nil), "exocore.assets.v1.StakerAssetInfo") @@ -914,89 +838,88 @@ func init() { func init() { proto.RegisterFile("exocore/assets/v1/tx.proto", fileDescriptor_adb6ebd423a2c426) } var fileDescriptor_adb6ebd423a2c426 = []byte{ - // 1309 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x13, 0xc7, - 0x17, 0xcf, 0x3a, 0xbf, 0x9f, 0xf3, 0xc3, 0x19, 0x07, 0x62, 0x9b, 0x2f, 0x0e, 0xf2, 0xb7, 0x45, - 0x69, 0x04, 0x36, 0xa4, 0x2a, 0xa5, 0xa1, 0x97, 0x38, 0x01, 0x29, 0x15, 0xb4, 0xd5, 0x1a, 0x7a, - 0x40, 0x2a, 0xab, 0xb1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x84, 0x98, 0x03, 0xa0, 0x4a, 0x11, 0x16, 0x0e, 0xe5, 0x14, 0xe7, - 0xbb, 0xf2, 0xdb, 0x30, 0x0c, 0xdf, 0x61, 0x0e, 0x7a, 0x00, 0x53, 0x89, 0x9c, 0xd3, 0x3a, 0xe4, - 0x10, 0x46, 0x69, 0xf9, 0x64, 0x9f, 0x98, 0x07, 0x7d, 0x03, 0xf3, 0x0d, 0xc2, 0xd5, 0x31, 0xd8, - 0x3f, 0x59, 0xde, 0x4b, 0xc7, 0x48, 0xbe, 0x1d, 0xa5, 0x4b, 0x6f, 0xe3, 0xd5, 0xe3, 0x0a, 0x21, - 0x9f, 0xd2, 0x76, 0xe8, 0x83, 0x14, 0x90, 0xf4, 0x57, 0xad, 0x54, 0x7d, 0x5b, 0x57, 0xcd, 0xf8, - 0x00, 0xa6, 0x13, 0xed, 0x80, 0xfe, 0xff, 0x06, 0x80, 0xb8, 0xd5, 0x4b, 0x4b, 0x27, 0x3b, 0x29, - 0xfc, 0xd2, 0xe8, 0x77, 0xaf, 0x9f, 0x2c, 0x1b, 0xf5, 0xcf, 0x9e, 0xed, 0x97, 0x8d, 0xe7, 0xfb, - 0x65, 0xe3, 0xe5, 0x7e, 0xd9, 0xf8, 0xf9, 0x55, 0x79, 0xe8, 0xf9, 0xab, 0xf2, 0xd0, 0x5f, 0xaf, - 0xca, 0x43, 0xf7, 0xaf, 0xf4, 0xcd, 0xfe, 0x9b, 0x0a, 0xf4, 0x73, 0xc2, 0x77, 0x69, 0xb4, 0x53, - 0x8b, 0x07, 0x51, 0x27, 0xfe, 0xc4, 0x96, 0x27, 0x41, 0x73, 0x4c, 0x7e, 0x49, 0x7f, 0xf8, 0x6f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x44, 0xc7, 0x28, 0xb8, 0xf7, 0x0f, 0x00, 0x00, + // 1283 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 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0xa1, + 0x47, 0x51, 0x6c, 0x8c, 0x89, 0x1e, 0x60, 0x6a, 0xf7, 0xb5, 0x59, 0x21, 0xe6, 0x00, 0xa8, 0x56, + 0x86, 0xc5, 0x43, 0x6b, 0x8a, 0xd7, 0xbb, 0xfa, 0xdb, 0x28, 0x8c, 0xde, 0x62, 0x2e, 0xba, 0x07, + 0xa7, 0x52, 0x6b, 0xce, 0xaa, 0x90, 0x43, 0x18, 0x95, 0x95, 0x93, 0x7d, 0x62, 0x1e, 0xf4, 0x2d, + 0x2c, 0x34, 0x09, 0x57, 0xc7, 0xe0, 0x60, 0x67, 0x79, 0x2f, 0x1b, 0x23, 0xbd, 0x3b, 0x2a, 0x17, + 0xde, 0xc4, 0x2b, 0xe1, 0xea, 0x40, 0x31, 0xa3, 0xec, 0xd0, 0x87, 0x19, 0x20, 0xd9, 0x5b, 0xad, + 0x52, 0x7f, 0x53, 0x57, 0xcd, 0x78, 0x0f, 0x66, 0x52, 0xe5, 0x80, 0xde, 0x7d, 0x0d, 0x40, 0x5c, + 0xea, 0x95, 0xe5, 0x93, 0x9d, 0x14, 0x7e, 0x65, 0xfc, 0xfb, 0x57, 0x8f, 0x56, 0x8c, 0x8d, 0xcf, + 0x9f, 0xec, 0x57, 0x8d, 0xa7, 0xfb, 0x55, 0xe3, 0xc5, 0x7e, 0xd5, 0xf8, 0xe5, 0x65, 0x75, 0xe4, + 0xe9, 0xcb, 0xea, 0xc8, 0x5f, 0x2f, 0xab, 0x23, 0x77, 0x2f, 0x0d, 0xf4, 0xfe, 0xeb, 0x0a, 0xf4, + 0x0b, 0xc2, 0xf7, 0x68, 0xb4, 0xdb, 0x88, 0x1b, 0x51, 0x2f, 0xfe, 0x90, 0x95, 0x27, 0x41, 0x6b, + 0x42, 0x7e, 0xaf, 0x7e, 0xf4, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x74, 0x4a, 0xca, 0xb0, 0x5d, + 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1297,55 +1220,6 @@ func (m *ClientChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AppChainInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AppChainInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AppChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExocoreChainIndex != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ExocoreChainIndex)) - 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.MetaInfo) > 0 { - i -= len(m.MetaInfo) - copy(dAtA[i:], m.MetaInfo) - i = encodeVarintTx(dAtA, i, uint64(len(m.MetaInfo))) - 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 *AssetInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1982,30 +1856,6 @@ func (m *ClientChainInfo) Size() (n int) { return n } -func (m *AppChainInfo) 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.MetaInfo) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.ExocoreChainIndex != 0 { - n += 1 + sovTx(uint64(m.ExocoreChainIndex)) - } - return n -} - func (m *AssetInfo) Size() (n int) { if m == nil { return 0 @@ -2559,171 +2409,6 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *AppChainInfo) Unmarshal(dAtA []byte) 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: AppChainInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AppChainInfo: 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 MetaInfo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MetaInfo = string(dAtA[iNdEx:postIndex]) - 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 ExocoreChainIndex", wireType) - } - m.ExocoreChainIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExocoreChainIndex |= 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 *AssetInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/avs/client/cli/tx.go b/x/avs/client/cli/tx.go index 46a58a421..df1f4d9bc 100644 --- a/x/avs/client/cli/tx.go +++ b/x/avs/client/cli/tx.go @@ -45,7 +45,7 @@ func RegisterAVS() *cobra.Command { Name: args[0], AvsAddress: args[1], OperatorAddress: []string{args[2]}, - AvsOwnerAddress: args[3], + AvsOwnerAddress: []string{args[3]}, AssetId: []string{args[4]}, }, } diff --git a/x/avs/keeper/avs.go b/x/avs/keeper/avs.go new file mode 100644 index 000000000..eb34d46b8 --- /dev/null +++ b/x/avs/keeper/avs.go @@ -0,0 +1,42 @@ +package keeper + +import ( + "fmt" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k *Keeper) GetAVSSupportedAssets(ctx sdk.Context, avsAddr string) ([]string, error) { + avsInfo, err := k.GetAVSInfo(ctx, avsAddr) + if err != nil { + return nil, errorsmod.Wrap(err, fmt.Sprintf("GetAVSSupportedAssets: key is %s", avsAddr)) + } + + return avsInfo.Info.AssetId, nil +} + +func (k *Keeper) GetAVSSlashContract(ctx sdk.Context, avsAddr string) (string, error) { + avsInfo, err := k.GetAVSInfo(ctx, avsAddr) + if err != nil { + return "", errorsmod.Wrap(err, fmt.Sprintf("GetAVSSlashContract: key is %s", avsAddr)) + } + + return avsInfo.Info.SlashAddr, nil +} + +// GetAVSMinimumSelfDelegation returns the USD value of minimum self delegation, which +// is set for operator +func (k *Keeper) GetAVSMinimumSelfDelegation(ctx sdk.Context, avsAddr string) (sdkmath.LegacyDec, error) { + avsInfo, err := k.GetAVSInfo(ctx, avsAddr) + if err != nil { + return sdkmath.LegacyNewDec(0), errorsmod.Wrap(err, fmt.Sprintf("GetAVSMinimumSelfDelegation: key is %s", avsAddr)) + } + + return sdkmath.LegacyNewDec(avsInfo.Info.MinSelfDelegation.Int64()), nil +} + +// GetEpochEndAVSs returns the AVS list where the current block marks the end of their epoch. +// func (k *Keeper) GetEpochEndAVSs(ctx sdk.Context) ([]string, error) { diff --git a/x/avs/keeper/avs_test.go b/x/avs/keeper/avs_test.go index 59d0479c3..2552051fe 100644 --- a/x/avs/keeper/avs_test.go +++ b/x/avs/keeper/avs_test.go @@ -1,8 +1,32 @@ package keeper_test +import ( + "cosmossdk.io/math" + avstypes "github.com/ExocoreNetwork/exocore/x/avs/keeper" + "github.com/ExocoreNetwork/exocore/x/avs/types" + delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" + operatortype "github.com/ExocoreNetwork/exocore/x/operator/types" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + func (suite *AVSTestSuite) TestAVS() { - avsName, avsAddres, operatorAddress, assetID := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo18h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "" - err := suite.App.AVSManagerKeeper.SetAVSInfo(suite.Ctx, avsName, avsAddres, operatorAddress, assetID) + avsName, avsAddres, slashAddress := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutash" + avsOwnerAddress := []string{"exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj1", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj2"} + assetID := []string{"11", "22", "33"} + avs := &types.AVSInfo{ + Name: avsName, + AvsAddress: avsAddres, + SlashAddr: slashAddress, + AvsOwnerAddress: avsOwnerAddress, + AssetId: assetID, + AvsUnbondingPeriod: uint32(7), + MinSelfDelegation: sdk.NewIntFromUint64(10), + AvsEpoch: nil, + OperatorAddress: nil, + } + + err := suite.App.AVSManagerKeeper.SetAVSInfo(suite.Ctx, avs) suite.NoError(err) info, err := suite.App.AVSManagerKeeper.GetAVSInfo(suite.Ctx, avsAddres) @@ -11,3 +35,142 @@ func (suite *AVSTestSuite) TestAVS() { suite.Equal(avsAddres, info.GetInfo().AvsAddress) } + +func (suite *AVSTestSuite) TestAVSInfoUpdate_Register() { + avsName, avsAddres, slashAddress := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutash" + avsOwnerAddress := []string{"exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj1", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj2"} + assetID := []string{"11", "22", "33"} + + avsParams := &avstypes.AVSRegisterOrDeregisterParams{ + AvsName: avsName, + AvsAddress: avsAddres, + Action: avstypes.RegisterAction, + AvsOwnerAddress: avsOwnerAddress, + AssetID: assetID, + MinSelfDelegation: uint64(10), + UnbondingPeriod: uint64(7), + SlashContractAddr: slashAddress, + OperatorAddress: nil, + } + + err := suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams) + suite.NoError(err) + + info, err := suite.App.AVSManagerKeeper.GetAVSInfo(suite.Ctx, avsAddres) + + suite.NoError(err) + suite.Equal(avsAddres, info.GetInfo().AvsAddress) + + err = suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams) + suite.Error(err) + suite.Contains(err.Error(), types.ErrAlreadyRegistered.Error()) + +} +func (suite *AVSTestSuite) TestAVSInfoUpdate_DeRegister() { + // Test case setup + avsName, avsAddres, slashAddress := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutash" + avsOwnerAddress := []string{"exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj1", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj2"} + assetID := []string{"11", "22", "33", "44", "55"} // Multiple assets + + avsParams := &avstypes.AVSRegisterOrDeregisterParams{ + AvsName: avsName, + AvsAddress: avsAddres, + Action: avstypes.DeRegisterAction, + AvsOwnerAddress: avsOwnerAddress, + AssetID: assetID, + MinSelfDelegation: uint64(10), + UnbondingPeriod: uint64(7), + SlashContractAddr: slashAddress, + OperatorAddress: nil, + } + + err := suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams) + suite.Error(err) + suite.Contains(err.Error(), types.ErrUnregisterNonExistent.Error()) + + avsParams.Action = avstypes.RegisterAction + err = suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams) + suite.NoError(err) + info, err := suite.App.AVSManagerKeeper.GetAVSInfo(suite.Ctx, avsAddres) + suite.Equal(avsAddres, info.GetInfo().AvsAddress) + + avsParams.Action = avstypes.DeRegisterAction + err = suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams) + suite.NoError(err) + info, err = suite.App.AVSManagerKeeper.GetAVSInfo(suite.Ctx, avsAddres) + suite.Error(err) + suite.Contains(err.Error(), types.ErrNoKeyInTheStore.Error()) + +} + +func (suite *AVSTestSuite) TestAVSInfoUpdateWithOperator_Register() { + avsAddres, OperatorAddress := "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo19get9l6tj7pvn9xt83m7twpmup3usjvydpfscg" + + operatorParams := &avstypes.OperatorOptParams{ + AvsAddress: avsAddres, + Action: avstypes.RegisterAction, + OperatorAddress: OperatorAddress, + } + // operator Not Exist + err := suite.App.AVSManagerKeeper.AVSInfoUpdateWithOperator(suite.Ctx, operatorParams) + suite.Error(err) + suite.Contains(err.Error(), delegationtypes.ErrOperatorNotExist.Error()) + + //register operator but avs not register + info := &operatortype.OperatorInfo{ + EarningsAddr: suite.AccAddress.String(), + ApproveAddr: "", + OperatorMetaInfo: "test operator", + ClientChainEarningsAddr: &operatortype.ClientChainEarningAddrList{ + EarningInfoList: []*operatortype.ClientChainEarningAddrInfo{ + {101, "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"}, + }, + }, + Commission: stakingtypes.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()), + } + err = suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), info) + suite.NoError(err) + operatorParams.OperatorAddress = info.EarningsAddr + err = suite.App.AVSManagerKeeper.AVSInfoUpdateWithOperator(suite.Ctx, operatorParams) + suite.Error(err) + suite.Contains(err.Error(), types.ErrNoKeyInTheStore.Error()) + + //register avs + avsName, avsAddres, slashAddress := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutash" + avsOwnerAddress := []string{"exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj1", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj2"} + assetID := []string{"11", "22", "33"} + + avsParams := &avstypes.AVSRegisterOrDeregisterParams{ + AvsName: avsName, + AvsAddress: avsAddres, + Action: avstypes.RegisterAction, + AvsOwnerAddress: avsOwnerAddress, + AssetID: assetID, + MinSelfDelegation: uint64(10), + UnbondingPeriod: uint64(7), + SlashContractAddr: slashAddress, + OperatorAddress: nil, + } + + err = suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams) + suite.NoError(err) + + operatorParams.AvsAddress = avsAddres + err = suite.App.AVSManagerKeeper.AVSInfoUpdateWithOperator(suite.Ctx, operatorParams) + suite.NoError(err) + //duplicate register operator + err = suite.App.AVSManagerKeeper.AVSInfoUpdateWithOperator(suite.Ctx, operatorParams) + suite.Error(err) + suite.Contains(err.Error(), types.ErrAlreadyRegistered.Error()) + //deregister operator + operatorParams.Action = avstypes.DeRegisterAction + err = suite.App.AVSManagerKeeper.AVSInfoUpdateWithOperator(suite.Ctx, operatorParams) + suite.NoError(err) + + //duplicate deregister operator + operatorParams.Action = avstypes.DeRegisterAction + err = suite.App.AVSManagerKeeper.AVSInfoUpdateWithOperator(suite.Ctx, operatorParams) + suite.Error(err) + suite.Contains(err.Error(), types.ErrUnregisterNonExistent.Error()) + +} diff --git a/x/avs/keeper/keeper.go b/x/avs/keeper/keeper.go index 316d8e657..cffd47d35 100644 --- a/x/avs/keeper/keeper.go +++ b/x/avs/keeper/keeper.go @@ -2,8 +2,10 @@ package keeper import ( "fmt" + "slices" errorsmod "cosmossdk.io/errors" + assettypes "github.com/ExocoreNetwork/exocore/x/assets/keeper" delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/cometbft/cometbft/libs/log" @@ -44,47 +46,83 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { } func (k Keeper) AVSInfoUpdate(ctx sdk.Context, params *AVSRegisterOrDeregisterParams) error { + avsInfo, _ := k.GetAVSInfo(ctx, params.AvsAddress) + + action := params.Action + + switch action { + case RegisterAction: + if avsInfo != nil { + return errorsmod.Wrap(types.ErrAlreadyRegistered, fmt.Sprintf("the avsaddress is :%s", params.AvsAddress)) + } + avs := &types.AVSInfo{ + Name: params.AvsName, + AvsAddress: params.AvsAddress, + SlashAddr: params.SlashContractAddr, + AvsOwnerAddress: params.AvsOwnerAddress, + AssetId: params.AssetID, + MinSelfDelegation: sdk.NewIntFromUint64(params.MinSelfDelegation), + AvsUnbondingPeriod: uint32(params.UnbondingPeriod), + AvsEpoch: nil, + OperatorAddress: nil, + } + return k.SetAVSInfo(ctx, avs) + case DeRegisterAction: + if avsInfo == nil { + return errorsmod.Wrap(types.ErrUnregisterNonExistent, fmt.Sprintf("the avsaddress is :%s", params.AvsAddress)) + } + //TODO:if avs DeRegisterAction check UnbondingPeriod + // if avsInfo.Info.AvsUnbondingPeriod < currenUnbondingPeriod - regUnbondingPeriod { + // return errorsmod.Wrap(err, fmt.Sprintf("not qualified to deregister %s", avsInfo)) + //} + return k.DeleteAVSInfo(ctx, params.AvsAddress) + default: + return errorsmod.Wrap(types.ErrInvalidAction, fmt.Sprintf("Invalid action: %d", action)) + } +} + +func (k Keeper) AVSInfoUpdateWithOperator(ctx sdk.Context, params *OperatorOptParams) error { operatorAddress := params.OperatorAddress opAccAddr, err := sdk.AccAddressFromBech32(operatorAddress) if err != nil { return errorsmod.Wrap(err, fmt.Sprintf("error occurred when parse acc address from Bech32,the addr is:%s", operatorAddress)) } if !k.operatorKeeper.IsOperator(ctx, opAccAddr) { - return errorsmod.Wrap(delegationtypes.ErrOperatorNotExist, "AVSInfoUpdate: invalid operator address") + return errorsmod.Wrap(delegationtypes.ErrOperatorNotExist, fmt.Sprintf("AVSInfoUpdate: invalid operator address:%s", operatorAddress)) } + avsInfo, err := k.GetAVSInfo(ctx, params.AvsAddress) + if err != nil || avsInfo == nil { + return errorsmod.Wrap(err, fmt.Sprintf("error occurred when get avs info,this avs address: %s", params.AvsAddress)) + } + avs := avsInfo.GetInfo() + addresses := avs.OperatorAddress - action := params.Action - - if action == RegisterAction { - return k.SetAVSInfo(ctx, params.AvsName, params.AvsAddress, operatorAddress, params.AssetID) + if params.Action == RegisterAction && slices.Contains(avs.OperatorAddress, operatorAddress) { + return errorsmod.Wrap(types.ErrAlreadyRegistered, fmt.Sprintf("Error: Already registered,operatorAddress %s", operatorAddress)) } - avsInfo, err := k.GetAVSInfo(ctx, params.AvsAddress) - if err != nil { - return errorsmod.Wrap(err, fmt.Sprintf("error occurred when get avs info %s", avsInfo)) + + if params.Action == RegisterAction && !slices.Contains(avs.OperatorAddress, operatorAddress) { + addresses = append(addresses, operatorAddress) + avs.OperatorAddress = addresses + return k.SetAVSInfo(ctx, avs) } - if avsInfo.Info.AvsOwnerAddress != params.AvsOwnerAddress { - return errorsmod.Wrap(err, fmt.Sprintf("not qualified to deregister %s", avsInfo)) + + if params.Action == DeRegisterAction && slices.Contains(avs.OperatorAddress, operatorAddress) { + avs.OperatorAddress = types.RemoveOperatorAddress(addresses, operatorAddress) + return k.SetAVSInfo(ctx, avs) } - return k.DeleteAVSInfo(ctx, params.AvsAddress) + return errorsmod.Wrap(types.ErrUnregisterNonExistent, fmt.Sprintf("No available operatorAddress to DeRegisterAction ,operatorAddress: %s", operatorAddress)) } -func (k Keeper) SetAVSInfo(ctx sdk.Context, avsName, avsAddress, operatorAddress, assetID string) (err error) { - avsAddr, err := sdk.AccAddressFromBech32(avsAddress) +func (k Keeper) SetAVSInfo(ctx sdk.Context, avs *types.AVSInfo) (err error) { + avsAddr, err := sdk.AccAddressFromBech32(avs.AvsAddress) if err != nil { return errorsmod.Wrap(err, "SetAVSInfo: error occurred when parse acc address from Bech32") } store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixAVSInfo) - if !store.Has(avsAddr) { - AVSInfo := &types.AVSInfo{Name: avsName, AvsAddress: avsAddress, OperatorAddress: []string{operatorAddress}, AssetId: []string{assetID}} - bz := k.cdc.MustMarshal(AVSInfo) - store.Set(avsAddr, bz) - return nil - } - value := store.Get(avsAddr) - ret := &types.AVSInfo{} - k.cdc.MustUnmarshal(value, ret) - ret.OperatorAddress = append(ret.OperatorAddress, operatorAddress) - ret.AssetId = append(ret.AssetId, assetID) + + bz := k.cdc.MustMarshal(avs) + store.Set(avsAddr, bz) return nil } diff --git a/x/avs/keeper/params.go b/x/avs/keeper/params.go index 367a0230e..550083de4 100644 --- a/x/avs/keeper/params.go +++ b/x/avs/keeper/params.go @@ -34,10 +34,23 @@ func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error { type AVSRegisterOrDeregisterParams struct { AvsName string AvsAddress string - OperatorAddress string Action uint64 - AvsOwnerAddress string - AssetID string + AvsOwnerAddress []string + AssetID []string + + MinSelfDelegation uint64 + UnbondingPeriod uint64 + SlashContractAddr string + OperatorAddress []string +} +type OperatorOptParams struct { + Name string + BlsPublicKey string + IsRegistered bool + Action uint64 + OperatorAddress string + Status string + AvsAddress string } const ( diff --git a/x/avs/types/errors.go b/x/avs/types/errors.go index 705986b4c..f000e9046 100644 --- a/x/avs/types/errors.go +++ b/x/avs/types/errors.go @@ -9,4 +9,18 @@ import ( // x/avs module sentinel errors var ( ErrNoKeyInTheStore = errorsmod.Register(ModuleName, 0, "there is no such key in the store") + + ErrAlreadyRegistered = errorsmod.Register( + ModuleName, 1, + "Error: Already registered", + ) + ErrUnregisterNonExistent = errorsmod.Register( + ModuleName, 2, + "Error: No available avs to DeRegisterAction", + ) + + ErrInvalidAction = errorsmod.Register( + ModuleName, 3, + "Error: Undefined action", + ) ) diff --git a/x/avs/types/query.pb.go b/x/avs/types/query.pb.go index 7a23a3394..b7ee18426 100644 --- a/x/avs/types/query.pb.go +++ b/x/avs/types/query.pb.go @@ -29,7 +29,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryAVSInfoReq is the request to query avs related information type QueryAVSInfoReq struct { + // avs_address is the address of avs AVSAddres string `protobuf:"bytes,1,opt,name=avs_address,json=avsAddress,proto3" json:"avs_address,omitempty"` } @@ -73,7 +75,9 @@ func (m *QueryAVSInfoReq) GetAVSAddres() string { return "" } +// QueryAVSInfoResponse is the response of avs related information type QueryAVSInfoResponse struct { + // basic information of avs Info *AVSInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"` } @@ -128,23 +132,23 @@ var fileDescriptor_d9df5f5965203ddc = []byte{ // 303 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0x2c, 0x2b, 0xd6, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x4a, 0xe8, 0x25, 0x96, 0x15, 0x4b, 0x89, 0xa4, 0xe7, 0xa7, - 0xe7, 0x83, 0xc5, 0xf5, 0x41, 0x2c, 0x88, 0x12, 0x29, 0x99, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, - 0xfd, 0xc4, 0x82, 0x4c, 0xfd, 0xc4, 0xbc, 0xbc, 0xfc, 0x92, 0xc4, 0x92, 0xcc, 0xfc, 0xbc, 0x62, - 0xa8, 0xac, 0x08, 0xb2, 0xc9, 0x25, 0x15, 0x10, 0x51, 0x25, 0x47, 0x2e, 0xfe, 0x40, 0x90, 0x2d, - 0x8e, 0x61, 0xc1, 0x9e, 0x79, 0x69, 0xf9, 0x41, 0xa9, 0x85, 0x42, 0x7a, 0x5c, 0xdc, 0x89, 0x65, - 0xc5, 0xf1, 0x89, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, - 0xbc, 0x8f, 0xee, 0xc9, 0x73, 0x3a, 0x86, 0x05, 0x3b, 0x82, 0x45, 0x83, 0xb8, 0x12, 0xcb, 0x8a, - 0x21, 0xcc, 0x62, 0x25, 0x07, 0x2e, 0x11, 0x54, 0x23, 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, - 0x34, 0xb8, 0x58, 0x32, 0xf3, 0xd2, 0xf2, 0xc1, 0x06, 0x70, 0x1b, 0x89, 0xe8, 0x21, 0x79, 0x40, - 0x0f, 0xa6, 0x16, 0xac, 0xc2, 0xa8, 0x9b, 0x91, 0x8b, 0x15, 0x6c, 0x84, 0x50, 0x23, 0x23, 0x17, - 0x0f, 0xb2, 0x61, 0x42, 0x32, 0x28, 0xda, 0xd0, 0x9c, 0x2a, 0xa5, 0x88, 0x47, 0x16, 0xe2, 0x0a, - 0x25, 0x83, 0xa6, 0xcb, 0x4f, 0x26, 0x33, 0x69, 0x09, 0x69, 0xe8, 0xbb, 0x42, 0x94, 0xfa, 0xa5, - 0x96, 0x94, 0xe7, 0x17, 0x65, 0xeb, 0x23, 0x07, 0x07, 0xb2, 0x4e, 0x27, 0xf7, 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, 0xd2, 0x4d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, 0xa9, 0x05, 0xab, 0x30, 0xea, 0x66, 0xe4, 0x62, 0x05, 0x1b, 0x21, 0xd4, 0xc8, 0xc8, 0xc5, + 0x83, 0x6c, 0x98, 0x90, 0x0c, 0x8a, 0x36, 0x34, 0xa7, 0x4a, 0x29, 0xe2, 0x91, 0x85, 0xb8, 0x42, + 0xc9, 0xa0, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0x5a, 0x42, 0x1a, 0xfa, 0xae, 0x10, 0xa5, 0x7e, 0xa9, + 0x25, 0xe5, 0xf9, 0x45, 0xd9, 0xfa, 0xc8, 0x41, 0x88, 0xac, 0xd3, 0xc9, 0xfd, 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, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0x71, 0x99, 0x56, 0x01, 0x89, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x10, + 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x89, 0x99, 0x19, 0x87, 0xd4, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/avs/types/query.pb.gw.go b/x/avs/types/query.pb.gw.go index b2855b174..0bbcae265 100644 --- a/x/avs/types/query.pb.gw.go +++ b/x/avs/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join var ( filter_Query_QueryAVSInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} @@ -70,12 +72,14 @@ func local_request_Query_QueryAVSInfo_0(ctx context.Context, marshaler runtime.M // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_QueryAVSInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -83,6 +87,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueryAVSInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/avs/types/tx.pb.go b/x/avs/types/tx.pb.go index 1c62e02c4..058d79d49 100644 --- a/x/avs/types/tx.pb.go +++ b/x/avs/types/tx.pb.go @@ -7,21 +7,28 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -29,13 +36,26 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// AVSinfo represent the information of avs type AVSInfo struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - AvsAddress string `protobuf:"bytes,2,opt,name=avs_address,json=avsAddress,proto3" json:"avs_address,omitempty"` - OperatorAddress []string `protobuf:"bytes,3,rep,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` - AvsOwnerAddress string `protobuf:"bytes,4,opt,name=avs_owner_address,json=avsOwnerAddress,proto3" json:"avs_owner_address,omitempty"` + // name of avs + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // address of avs + AvsAddress string `protobuf:"bytes,2,opt,name=avs_address,json=avsAddress,proto3" json:"avs_address,omitempty"` + // slash address of avs + SlashAddr string `protobuf:"bytes,3,opt,name=slash_addr,json=slashAddr,proto3" json:"slash_addr,omitempty"` + // the owner who has permission for avs + AvsOwnerAddress []string `protobuf:"bytes,4,rep,name=avs_owner_address,json=avsOwnerAddress,proto3" json:"avs_owner_address,omitempty"` // asset_basic_info is all the basic asset information of the avs. AssetId []string `protobuf:"bytes,5,rep,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + // unbonding duration of avs. + AvsUnbondingPeriod uint32 `protobuf:"varint,6,opt,name=avs_unbonding_period,json=avsUnbondingPeriod,proto3" json:"avs_unbonding_period,omitempty"` + // the operator minimum delegation amount. + MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation"` + //avs epoch ,Subsequently will be handled by the epochs module. + AvsEpoch *EpochInfo `protobuf:"bytes,8,opt,name=avs_epoch,json=avsEpoch,proto3" json:"avs_epoch,omitempty"` + // registered operator of avs + OperatorAddress []string `protobuf:"bytes,9,rep,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` } func (m *AVSInfo) Reset() { *m = AVSInfo{} } @@ -85,18 +105,18 @@ func (m *AVSInfo) GetAvsAddress() string { return "" } -func (m *AVSInfo) GetOperatorAddress() []string { +func (m *AVSInfo) GetSlashAddr() string { if m != nil { - return m.OperatorAddress + return m.SlashAddr } - return nil + return "" } -func (m *AVSInfo) GetAvsOwnerAddress() string { +func (m *AVSInfo) GetAvsOwnerAddress() []string { if m != nil { return m.AvsOwnerAddress } - return "" + return nil } func (m *AVSInfo) GetAssetId() []string { @@ -106,16 +126,141 @@ func (m *AVSInfo) GetAssetId() []string { return nil } +func (m *AVSInfo) GetAvsUnbondingPeriod() uint32 { + if m != nil { + return m.AvsUnbondingPeriod + } + return 0 +} + +func (m *AVSInfo) GetAvsEpoch() *EpochInfo { + if m != nil { + return m.AvsEpoch + } + return nil +} + +func (m *AVSInfo) GetOperatorAddress() []string { + if m != nil { + return m.OperatorAddress + } + return nil +} + +// EpochInfo defines the message interface containing the relevant informations aboutt +// an epoch. +type EpochInfo struct { + // identifier of the epoch + Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` + // start_time of the epoch + StartTime time.Time `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time" yaml:"start_time"` + // duration of the epoch + Duration time.Duration `protobuf:"bytes,3,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"` + // current_epoch is the integer identifier of the epoch + CurrentEpoch int64 `protobuf:"varint,4,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"` + // current_epoch_start_time defines the timestamp of the start of the epoch + CurrentEpochStartTime time.Time `protobuf:"bytes,5,opt,name=current_epoch_start_time,json=currentEpochStartTime,proto3,stdtime" json:"current_epoch_start_time" yaml:"current_epoch_start_time"` + // epoch_counting_started reflects if the counting for the epoch has started + EpochCountingStarted bool `protobuf:"varint,6,opt,name=epoch_counting_started,json=epochCountingStarted,proto3" json:"epoch_counting_started,omitempty"` + // current_epoch_start_height of the epoch + CurrentEpochStartHeight int64 `protobuf:"varint,7,opt,name=current_epoch_start_height,json=currentEpochStartHeight,proto3" json:"current_epoch_start_height,omitempty"` +} + +func (m *EpochInfo) Reset() { *m = EpochInfo{} } +func (m *EpochInfo) String() string { return proto.CompactTextString(m) } +func (*EpochInfo) ProtoMessage() {} +func (*EpochInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_c92b5dfe90086a66, []int{1} +} +func (m *EpochInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EpochInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochInfo.Merge(m, src) +} +func (m *EpochInfo) XXX_Size() int { + return m.Size() +} +func (m *EpochInfo) XXX_DiscardUnknown() { + xxx_messageInfo_EpochInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochInfo proto.InternalMessageInfo + +func (m *EpochInfo) GetIdentifier() string { + if m != nil { + return m.Identifier + } + return "" +} + +func (m *EpochInfo) GetStartTime() time.Time { + if m != nil { + return m.StartTime + } + return time.Time{} +} + +func (m *EpochInfo) GetDuration() time.Duration { + if m != nil { + return m.Duration + } + return 0 +} + +func (m *EpochInfo) GetCurrentEpoch() int64 { + if m != nil { + return m.CurrentEpoch + } + return 0 +} + +func (m *EpochInfo) GetCurrentEpochStartTime() time.Time { + if m != nil { + return m.CurrentEpochStartTime + } + return time.Time{} +} + +func (m *EpochInfo) GetEpochCountingStarted() bool { + if m != nil { + return m.EpochCountingStarted + } + return false +} + +func (m *EpochInfo) GetCurrentEpochStartHeight() int64 { + if m != nil { + return m.CurrentEpochStartHeight + } + return 0 +} + +// RegisterAVSReq is requst to register avs type RegisterAVSReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Info *AVSInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // from_address is the source + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // avs information + Info *AVSInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } func (m *RegisterAVSReq) Reset() { *m = RegisterAVSReq{} } func (m *RegisterAVSReq) String() string { return proto.CompactTextString(m) } func (*RegisterAVSReq) ProtoMessage() {} func (*RegisterAVSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{1} + return fileDescriptor_c92b5dfe90086a66, []int{2} } func (m *RegisterAVSReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -158,16 +303,19 @@ func (m *RegisterAVSReq) GetInfo() *AVSInfo { return nil } +// RegisterAVSResponse is the response for register avs type RegisterAVSResponse struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Info *AVSInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // from_address is the source + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // avs information + Info *AVSInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } func (m *RegisterAVSResponse) Reset() { *m = RegisterAVSResponse{} } func (m *RegisterAVSResponse) String() string { return proto.CompactTextString(m) } func (*RegisterAVSResponse) ProtoMessage() {} func (*RegisterAVSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{2} + return fileDescriptor_c92b5dfe90086a66, []int{3} } func (m *RegisterAVSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -210,16 +358,19 @@ func (m *RegisterAVSResponse) GetInfo() *AVSInfo { return nil } +// DeRegisterAVSReq is requst to deregister avs type DeRegisterAVSReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Info *AVSInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // from_address is the source address + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // avs information + Info *AVSInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } func (m *DeRegisterAVSReq) Reset() { *m = DeRegisterAVSReq{} } func (m *DeRegisterAVSReq) String() string { return proto.CompactTextString(m) } func (*DeRegisterAVSReq) ProtoMessage() {} func (*DeRegisterAVSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{3} + return fileDescriptor_c92b5dfe90086a66, []int{4} } func (m *DeRegisterAVSReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -262,16 +413,19 @@ func (m *DeRegisterAVSReq) GetInfo() *AVSInfo { return nil } +// DeRegisterAVSResponse is requst to register avs type DeRegisterAVSResponse struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` - Info *AVSInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // from_address is the source address + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // avs information + Info *AVSInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } func (m *DeRegisterAVSResponse) Reset() { *m = DeRegisterAVSResponse{} } func (m *DeRegisterAVSResponse) String() string { return proto.CompactTextString(m) } func (*DeRegisterAVSResponse) ProtoMessage() {} func (*DeRegisterAVSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{4} + return fileDescriptor_c92b5dfe90086a66, []int{5} } func (m *DeRegisterAVSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -316,6 +470,7 @@ func (m *DeRegisterAVSResponse) GetInfo() *AVSInfo { func init() { proto.RegisterType((*AVSInfo)(nil), "exocore.avs.AVSInfo") + proto.RegisterType((*EpochInfo)(nil), "exocore.avs.EpochInfo") proto.RegisterType((*RegisterAVSReq)(nil), "exocore.avs.RegisterAVSReq") proto.RegisterType((*RegisterAVSResponse)(nil), "exocore.avs.RegisterAVSResponse") proto.RegisterType((*DeRegisterAVSReq)(nil), "exocore.avs.DeRegisterAVSReq") @@ -325,35 +480,60 @@ func init() { func init() { proto.RegisterFile("exocore/avs/tx.proto", fileDescriptor_c92b5dfe90086a66) } var fileDescriptor_c92b5dfe90086a66 = []byte{ - // 448 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xcd, 0x92, 0x94, 0xd2, 0x31, 0xd0, 0xb0, 0x04, 0x91, 0x1a, 0x61, 0x22, 0x9f, 0x42, 0xa4, - 0xda, 0xa2, 0xdc, 0xe0, 0x94, 0x8a, 0x0f, 0x55, 0xe2, 0x43, 0x72, 0xa4, 0x1e, 0xb8, 0x44, 0xdb, - 0x78, 0x63, 0x2c, 0x64, 0xaf, 0xd9, 0x59, 0xdc, 0x70, 0x43, 0xdc, 0x10, 0x12, 0xea, 0x2f, 0x41, - 0x39, 0xf0, 0x23, 0x38, 0x56, 0x9c, 0x38, 0xa2, 0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f0, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3a, 0x5f, 0x36, 0xdd, 0x4a, 0x04, 0x00, 0x00, + // 848 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x60, 0xa7, 0xb1, 0x9f, 0x1b, 0x9a, 0x4c, 0xdd, 0x76, 0x63, 0x14, 0xaf, 0x65, 0x24, + 0x64, 0x02, 0xd9, 0xa5, 0x29, 0xa7, 0x96, 0x4b, 0x4c, 0x0a, 0x44, 0xe2, 0x97, 0xd6, 0x50, 0x21, + 0x2e, 0xd6, 0xc4, 0x3b, 0x5e, 0x8f, 0xea, 0x9d, 0x31, 0x3b, 0x63, 0x37, 0xb9, 0x55, 0xdc, 0x00, + 0x09, 0xe5, 0xc8, 0x1f, 0xc0, 0x19, 0xf5, 0xd0, 0x3f, 0xa2, 0xc7, 0xaa, 0x27, 0xc4, 0xc1, 0xa0, + 0xe4, 0x50, 0x89, 0x63, 0xff, 0x02, 0x34, 0x3f, 0xd6, 0xb1, 0x53, 0x0a, 0xc7, 0xf6, 0xb4, 0x3b, + 0xef, 0x7b, 0xef, 0x9b, 0x37, 0xdf, 0xfb, 0x76, 0x16, 0xaa, 0xf4, 0x50, 0xf4, 0x44, 0x46, 0x43, + 0x32, 0x91, 0xa1, 0x3a, 0x0c, 0x46, 0x99, 0x50, 0x02, 0x57, 0x5c, 0x34, 0x20, 0x13, 0x59, 0xbb, + 0xd6, 0x13, 0x32, 0x15, 0x32, 0x4c, 0x65, 0x12, 0x4e, 0xae, 0xeb, 0x87, 0xcd, 0xaa, 0x6d, 0x58, + 0xa0, 0x6b, 0x56, 0xa1, 0x5d, 0x38, 0xa8, 0x9a, 0x88, 0x44, 0xd8, 0xb8, 0x7e, 0x73, 0xd1, 0x7a, + 0x22, 0x44, 0x32, 0xa4, 0xa1, 0x59, 0x1d, 0x8c, 0xfb, 0x61, 0x3c, 0xce, 0x88, 0x62, 0x82, 0x3b, + 0xdc, 0x3f, 0x8f, 0x2b, 0x96, 0x52, 0xa9, 0x48, 0x3a, 0xb2, 0x09, 0xcd, 0x5f, 0x0b, 0xb0, 0xb2, + 0x7b, 0xa7, 0xb3, 0xcf, 0xfb, 0x02, 0x63, 0x28, 0x72, 0x92, 0x52, 0x0f, 0x35, 0x50, 0xab, 0x1c, + 0x99, 0x77, 0xec, 0x43, 0x85, 0x4c, 0x64, 0x97, 0xc4, 0x71, 0x46, 0xa5, 0xf4, 0x5e, 0x33, 0x10, + 0x90, 0x89, 0xdc, 0xb5, 0x11, 0xbc, 0x09, 0x20, 0x87, 0x44, 0x0e, 0x4c, 0x8a, 0x57, 0x30, 0x78, + 0xd9, 0x44, 0x74, 0x06, 0xde, 0x82, 0x75, 0x5d, 0x2f, 0xee, 0x71, 0x9a, 0xcd, 0x58, 0x8a, 0x8d, + 0x42, 0xab, 0x1c, 0x5d, 0x22, 0x13, 0xf9, 0x85, 0x8e, 0xe7, 0x54, 0x1b, 0x50, 0x22, 0x52, 0x52, + 0xd5, 0x65, 0xb1, 0xb7, 0x6c, 0x52, 0x56, 0xcc, 0x7a, 0x3f, 0xc6, 0xef, 0x41, 0x55, 0xd3, 0x8c, + 0xf9, 0x81, 0xe0, 0x31, 0xe3, 0x49, 0x77, 0x44, 0x33, 0x26, 0x62, 0xef, 0x42, 0x03, 0xb5, 0x56, + 0x23, 0x4c, 0x26, 0xf2, 0xeb, 0x1c, 0xfa, 0xd2, 0x20, 0x78, 0x08, 0x97, 0x53, 0xc6, 0xbb, 0x92, + 0x0e, 0xfb, 0xdd, 0x98, 0x0e, 0x69, 0x62, 0x64, 0xf1, 0x56, 0x74, 0x83, 0xed, 0x0f, 0x1e, 0x4d, + 0xfd, 0xa5, 0x3f, 0xa6, 0xfe, 0x5b, 0x09, 0x53, 0x83, 0xf1, 0x41, 0xd0, 0x13, 0xa9, 0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xbe, 0xbc, 0x86, 0x7e, 0x42, 0xb0, 0xb6, + 0x47, 0x5f, 0x15, 0x79, 0x8e, 0x11, 0x5c, 0x39, 0xd7, 0xcd, 0x4b, 0x16, 0x68, 0xe7, 0x37, 0x04, + 0x85, 0xcf, 0x64, 0x82, 0x3f, 0x85, 0xca, 0x5c, 0x5f, 0xf8, 0x8d, 0x05, 0x92, 0x45, 0xfd, 0x6a, + 0x8d, 0x17, 0x83, 0xee, 0x38, 0x11, 0xac, 0x2e, 0x9c, 0x13, 0x6f, 0x2e, 0x94, 0x9c, 0x9f, 0x48, + 0xad, 0xf9, 0x5f, 0xb0, 0xe5, 0xac, 0x2d, 0xdf, 0x7f, 0xfa, 0x60, 0x0b, 0xb5, 0x3f, 0x7e, 0x74, + 0x52, 0x47, 0x8f, 0x4f, 0xea, 0xe8, 0xaf, 0x93, 0x3a, 0x3a, 0x3e, 0xad, 0x2f, 0x3d, 0x3e, 0xad, + 0x2f, 0xfd, 0x7e, 0x5a, 0x5f, 0xfa, 0x76, 0x7b, 0xee, 0xfa, 0xbe, 0x6d, 0xe9, 0x3e, 0xa7, 0xea, + 0x9e, 0xc8, 0xee, 0x86, 0xf9, 0x4f, 0xf8, 0xd0, 0xfe, 0x86, 0xf5, 0x4d, 0x7e, 0x70, 0xc1, 0x5c, + 0x01, 0x37, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x28, 0xfc, 0x29, 0x81, 0xa2, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -496,6 +676,42 @@ func (m *AVSInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.OperatorAddress) > 0 { + for iNdEx := len(m.OperatorAddress) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.OperatorAddress[iNdEx]) + copy(dAtA[i:], m.OperatorAddress[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddress[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if m.AvsEpoch != nil { + { + size, err := m.AvsEpoch.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + { + 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] = 0x3a + if m.AvsUnbondingPeriod != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.AvsUnbondingPeriod)) + i-- + dAtA[i] = 0x30 + } if len(m.AssetId) > 0 { for iNdEx := len(m.AssetId) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.AssetId[iNdEx]) @@ -506,21 +722,21 @@ func (m *AVSInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } if len(m.AvsOwnerAddress) > 0 { - i -= len(m.AvsOwnerAddress) - copy(dAtA[i:], m.AvsOwnerAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.AvsOwnerAddress))) - i-- - dAtA[i] = 0x22 - } - if len(m.OperatorAddress) > 0 { - for iNdEx := len(m.OperatorAddress) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.OperatorAddress[iNdEx]) - copy(dAtA[i:], m.OperatorAddress[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddress[iNdEx]))) + for iNdEx := len(m.AvsOwnerAddress) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AvsOwnerAddress[iNdEx]) + copy(dAtA[i:], m.AvsOwnerAddress[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.AvsOwnerAddress[iNdEx]))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } } + if len(m.SlashAddr) > 0 { + i -= len(m.SlashAddr) + copy(dAtA[i:], m.SlashAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.SlashAddr))) + i-- + dAtA[i] = 0x1a + } if len(m.AvsAddress) > 0 { i -= len(m.AvsAddress) copy(dAtA[i:], m.AvsAddress) @@ -538,6 +754,80 @@ func (m *AVSInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EpochInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EpochInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CurrentEpochStartHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CurrentEpochStartHeight)) + i-- + dAtA[i] = 0x38 + } + if m.EpochCountingStarted { + i-- + if m.EpochCountingStarted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.CurrentEpochStartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CurrentEpochStartTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintTx(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x2a + if m.CurrentEpoch != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CurrentEpoch)) + i-- + dAtA[i] = 0x20 + } + n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.Duration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.Duration):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintTx(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x1a + n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintTx(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x12 + if len(m.Identifier) > 0 { + i -= len(m.Identifier) + copy(dAtA[i:], m.Identifier) + i = encodeVarintTx(dAtA, i, uint64(len(m.Identifier))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *RegisterAVSReq) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -731,22 +1021,65 @@ func (m *AVSInfo) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if len(m.OperatorAddress) > 0 { - for _, s := range m.OperatorAddress { + l = len(m.SlashAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.AvsOwnerAddress) > 0 { + for _, s := range m.AvsOwnerAddress { l = len(s) n += 1 + l + sovTx(uint64(l)) } } - l = len(m.AvsOwnerAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } if len(m.AssetId) > 0 { for _, s := range m.AssetId { l = len(s) n += 1 + l + sovTx(uint64(l)) } } + if m.AvsUnbondingPeriod != 0 { + n += 1 + sovTx(uint64(m.AvsUnbondingPeriod)) + } + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTx(uint64(l)) + if m.AvsEpoch != nil { + l = m.AvsEpoch.Size() + n += 1 + l + sovTx(uint64(l)) + } + if len(m.OperatorAddress) > 0 { + for _, s := range m.OperatorAddress { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *EpochInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Identifier) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartTime) + n += 1 + l + sovTx(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.Duration) + n += 1 + l + sovTx(uint64(l)) + if m.CurrentEpoch != 0 { + n += 1 + sovTx(uint64(m.CurrentEpoch)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.CurrentEpochStartTime) + n += 1 + l + sovTx(uint64(l)) + if m.EpochCountingStarted { + n += 2 + } + if m.CurrentEpochStartHeight != 0 { + n += 1 + sovTx(uint64(m.CurrentEpochStartHeight)) + } return n } @@ -919,7 +1252,7 @@ func (m *AVSInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SlashAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -947,7 +1280,7 @@ func (m *AVSInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = append(m.OperatorAddress, string(dAtA[iNdEx:postIndex])) + m.SlashAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { @@ -979,7 +1312,7 @@ func (m *AVSInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AvsOwnerAddress = string(dAtA[iNdEx:postIndex]) + m.AvsOwnerAddress = append(m.AvsOwnerAddress, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 5: if wireType != 2 { @@ -1013,6 +1346,366 @@ func (m *AVSInfo) Unmarshal(dAtA []byte) error { } m.AssetId = append(m.AssetId, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AvsUnbondingPeriod", wireType) + } + m.AvsUnbondingPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AvsUnbondingPeriod |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + 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 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AvsEpoch", 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.AvsEpoch == nil { + m.AvsEpoch = &EpochInfo{} + } + if err := m.AvsEpoch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = append(m.OperatorAddress, 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 *EpochInfo) Unmarshal(dAtA []byte) 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: EpochInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identifier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identifier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Duration", 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_cosmos_gogoproto_types.StdDurationUnmarshal(&m.Duration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentEpoch", wireType) + } + m.CurrentEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentEpoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentEpochStartTime", 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_cosmos_gogoproto_types.StdTimeUnmarshal(&m.CurrentEpochStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochCountingStarted", 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.EpochCountingStarted = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentEpochStartHeight", wireType) + } + m.CurrentEpochStartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentEpochStartHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/avs/types/types.go b/x/avs/types/types.go index ab1254f4c..e2d3577ba 100644 --- a/x/avs/types/types.go +++ b/x/avs/types/types.go @@ -1 +1,11 @@ package types + +func RemoveOperatorAddress(addresses []string, addressToRemove string) []string { + for i, address := range addresses { + if address == addressToRemove { + addresses[i] = addresses[len(addresses)-1] + return addresses[:len(addresses)-1] + } + } + return addresses +} diff --git a/x/delegation/client/cli/query.go b/x/delegation/client/cli/query.go index 8bece122d..40e10a22e 100644 --- a/x/delegation/client/cli/query.go +++ b/x/delegation/client/cli/query.go @@ -3,10 +3,12 @@ package cli import ( "context" "strconv" + "strings" errorsmod "cosmossdk.io/errors" "github.com/ExocoreNetwork/exocore/x/assets/types" delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -26,6 +28,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand( QuerySingleDelegationInfo(), QueryDelegationInfo(), + QueryUndelegationHoldCount(), ) return cmd } @@ -49,10 +52,14 @@ func QuerySingleDelegationInfo() *cobra.Command { return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error()) } stakerID, assetID := types.GetStakeIDAndAssetIDFromStr(clientChainLzID, args[1], args[2]) + accAddr, err := sdk.AccAddressFromBech32(args[3]) + if err != nil { + return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error()) + } req := &delegationtype.SingleDelegationInfoReq{ - StakerID: stakerID, - AssetID: assetID, - OperatorAddr: args[3], + StakerID: stakerID, // already lowercase + AssetID: assetID, // already lowercase + OperatorAddr: accAddr.String(), // already lowercase } res, err := queryClient.QuerySingleDelegationInfo(context.Background(), req) if err != nil { @@ -78,11 +85,18 @@ func QueryDelegationInfo() *cobra.Command { if err != nil { return err } - + stakerID := strings.ToLower(args[0]) + if _, _, err := types.ValidateID(stakerID, false, false); err != nil { + return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error()) + } + assetID := strings.ToLower(args[1]) + if _, _, err := types.ValidateID(assetID, false, false); err != nil { + return errorsmod.Wrap(types.ErrInvalidCliCmdArg, err.Error()) + } queryClient := delegationtype.NewQueryClient(clientCtx) req := &delegationtype.DelegationInfoReq{ - StakerID: args[0], - AssetID: args[1], + StakerID: strings.ToLower(stakerID), + AssetID: strings.ToLower(assetID), } res, err := queryClient.QueryDelegationInfo(context.Background(), req) if err != nil { @@ -95,3 +109,32 @@ func QueryDelegationInfo() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +// QueryUndelegationHoldCount queries undelegation hold count for a record key. +func QueryUndelegationHoldCount() *cobra.Command { + cmd := &cobra.Command{ + Use: "QueryUndelegationHoldCount recordKey", + Short: "Get undelegation hold count", + Long: "Get undelegation hold count", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := delegationtype.NewQueryClient(clientCtx) + req := &delegationtype.UndelegationHoldCountReq{ + RecordKey: strings.ToLower(args[0]), + } + res, err := queryClient.QueryUndelegationHoldCount(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/delegation/keeper/genesis.go b/x/delegation/keeper/genesis.go index 7dd1577bd..9f029d661 100644 --- a/x/delegation/keeper/genesis.go +++ b/x/delegation/keeper/genesis.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" abci "github.com/cometbft/cometbft/abci/types" @@ -44,7 +45,7 @@ func (k Keeper) InitGenesis( // they are the LzNonce and TxHash } if err := k.delegateTo(ctx, delegationParams, false); err != nil { - panic(err) + panic(errorsmod.Wrap(err, "failed to delegate to operator")) } } } diff --git a/x/delegation/keeper/grpc_query.go b/x/delegation/keeper/grpc_query.go index 990479874..649bceb4d 100644 --- a/x/delegation/keeper/grpc_query.go +++ b/x/delegation/keeper/grpc_query.go @@ -18,3 +18,9 @@ func (k *Keeper) QueryDelegationInfo(ctx context.Context, info *delegationtype.D c := sdk.UnwrapSDKContext(ctx) return k.GetDelegationInfo(c, info.StakerID, info.AssetID) } + +func (k Keeper) QueryUndelegationHoldCount(ctx context.Context, req *delegationtype.UndelegationHoldCountReq) (*delegationtype.UndelegationHoldCountResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + res := k.GetUndelegationHoldCount(c, []byte(req.RecordKey)) + return &delegationtype.UndelegationHoldCountResponse{HoldCount: res}, nil +} diff --git a/x/delegation/keeper/share.go b/x/delegation/keeper/share.go index ca463b100..8c2940d32 100644 --- a/x/delegation/keeper/share.go +++ b/x/delegation/keeper/share.go @@ -21,6 +21,10 @@ func TokensFromShares(stakerShare, totalShare sdkmath.LegacyDec, totalAmount sdk return sdkmath.NewInt(0), errorsmod.Wrapf(delegationtypes.ErrInsufficientShares, "the stakerShare is:%v the totalShare is:%v", stakerShare, totalShare) } if totalShare.IsZero() { + if totalAmount.IsZero() { + // this can happen if everyone exits. + return sdkmath.NewInt(0), nil + } return sdkmath.NewInt(0), delegationtypes.ErrDivisorIsZero } return (stakerShare.MulInt(totalAmount)).Quo(totalShare).TruncateInt(), nil @@ -34,6 +38,10 @@ func TokensFromShares(stakerShare, totalShare sdkmath.LegacyDec, totalAmount sdk // we need to make sure the staker can't get a bigger share than they should get. func SharesFromTokens(totalShare sdkmath.LegacyDec, stakerAmount, totalAmount sdkmath.Int) (sdkmath.LegacyDec, error) { if totalAmount.IsZero() { + if totalShare.IsZero() { + // this can happen if everyone exits. + return sdkmath.LegacyZeroDec(), nil + } return sdkmath.LegacyZeroDec(), delegationtypes.ErrDivisorIsZero } return totalShare.MulInt(stakerAmount).QuoInt(totalAmount), nil diff --git a/x/delegation/keeper/share_test.go b/x/delegation/keeper/share_test.go index d82d551fc..ac9ff56a8 100644 --- a/x/delegation/keeper/share_test.go +++ b/x/delegation/keeper/share_test.go @@ -10,78 +10,87 @@ import ( func (suite *DelegationTestSuite) TestTokensFromShares() { testCases := []struct { // input - totalShare sdkmath.LegacyDec - operatorAmount sdkmath.Int - stakerShare sdkmath.LegacyDec + totalShare sdkmath.LegacyDec + totalAmount sdkmath.Int + stakerShare sdkmath.LegacyDec // output stakerAmount sdkmath.Int innerError error }{ // error cases { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(50), - stakerShare: sdkmath.LegacyNewDec(51), - innerError: delegationtypes.ErrInsufficientShares, - stakerAmount: sdkmath.NewInt(0), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(50), + stakerShare: sdkmath.LegacyNewDec(51), + innerError: delegationtypes.ErrInsufficientShares, + stakerAmount: sdkmath.NewInt(0), }, { - totalShare: sdkmath.LegacyNewDec(0), - operatorAmount: sdkmath.NewInt(50), - stakerShare: sdkmath.LegacyNewDec(0), - innerError: delegationtypes.ErrDivisorIsZero, - stakerAmount: sdkmath.NewInt(0), + totalShare: sdkmath.LegacyNewDec(0), + totalAmount: sdkmath.NewInt(50), + stakerShare: sdkmath.LegacyNewDec(0), + innerError: delegationtypes.ErrDivisorIsZero, + stakerAmount: sdkmath.NewInt(0), }, // the share will be equal to the amount if there isn't a slash event { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(50), - stakerShare: sdkmath.LegacyNewDec(0), - innerError: nil, - stakerAmount: sdkmath.NewInt(0), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(50), + stakerShare: sdkmath.LegacyNewDec(0), + innerError: nil, + stakerAmount: sdkmath.NewInt(0), }, { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(50), - stakerShare: sdkmath.LegacyMustNewDecFromStr("3.4"), - innerError: nil, - stakerAmount: sdkmath.NewInt(3), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(50), + stakerShare: sdkmath.LegacyMustNewDecFromStr("3.4"), + innerError: nil, + stakerAmount: sdkmath.NewInt(3), }, { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(50), - stakerShare: sdkmath.LegacyNewDec(50), - innerError: nil, - stakerAmount: sdkmath.NewInt(50), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(50), + stakerShare: sdkmath.LegacyNewDec(50), + innerError: nil, + stakerAmount: sdkmath.NewInt(50), }, // the share will be greater than the amount if there is a slash event { - totalShare: sdkmath.LegacyNewDec(70), - operatorAmount: sdkmath.NewInt(50), - stakerShare: sdkmath.LegacyNewDec(0), - innerError: nil, - stakerAmount: sdkmath.NewInt(0), + totalShare: sdkmath.LegacyNewDec(70), + totalAmount: sdkmath.NewInt(50), + stakerShare: sdkmath.LegacyNewDec(0), + innerError: nil, + stakerAmount: sdkmath.NewInt(0), + }, + { + totalShare: sdkmath.LegacyNewDec(70), + totalAmount: sdkmath.NewInt(50), + stakerShare: sdkmath.LegacyMustNewDecFromStr("3.4"), + innerError: nil, + stakerAmount: sdkmath.NewInt(2), }, { - totalShare: sdkmath.LegacyNewDec(70), - operatorAmount: sdkmath.NewInt(50), - stakerShare: sdkmath.LegacyMustNewDecFromStr("3.4"), - innerError: nil, - stakerAmount: sdkmath.NewInt(2), + totalShare: sdkmath.LegacyNewDec(70), + totalAmount: sdkmath.NewInt(50), + stakerShare: sdkmath.LegacyNewDec(70), + innerError: nil, + stakerAmount: sdkmath.NewInt(50), }, + + // all exit { - totalShare: sdkmath.LegacyNewDec(70), - operatorAmount: sdkmath.NewInt(50), - stakerShare: sdkmath.LegacyNewDec(70), - innerError: nil, - stakerAmount: sdkmath.NewInt(50), + totalShare: sdkmath.LegacyNewDec(0), + stakerShare: sdkmath.LegacyNewDec(0), + totalAmount: sdkmath.NewInt(0), + stakerAmount: sdkmath.NewInt(0), + innerError: nil, }, } for _, testCase := range testCases { - amount, err := keeper.TokensFromShares(testCase.stakerShare, testCase.totalShare, testCase.operatorAmount) + amount, err := keeper.TokensFromShares(testCase.stakerShare, testCase.totalShare, testCase.totalAmount) if testCase.innerError != nil { suite.ErrorContains(err, testCase.innerError.Error()) } else { @@ -94,9 +103,9 @@ func (suite *DelegationTestSuite) TestTokensFromShares() { func (suite *DelegationTestSuite) TestSharesFromTokens() { testCases := []struct { // input - totalShare sdkmath.LegacyDec - operatorAmount sdkmath.Int - stakerAmount sdkmath.Int + totalShare sdkmath.LegacyDec + totalAmount sdkmath.Int + stakerAmount sdkmath.Int // output stakerShare sdkmath.LegacyDec @@ -104,69 +113,78 @@ func (suite *DelegationTestSuite) TestSharesFromTokens() { }{ // error cases { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(0), - stakerAmount: sdkmath.NewInt(0), - innerError: delegationtypes.ErrDivisorIsZero, - stakerShare: sdkmath.LegacyNewDec(0), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(0), + stakerAmount: sdkmath.NewInt(0), + innerError: delegationtypes.ErrDivisorIsZero, + stakerShare: sdkmath.LegacyNewDec(0), }, // the share will be equal to the amount if there isn't a slash event { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(50), - stakerAmount: sdkmath.NewInt(0), - innerError: nil, - stakerShare: sdkmath.LegacyNewDec(0), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(50), + stakerAmount: sdkmath.NewInt(0), + innerError: nil, + stakerShare: sdkmath.LegacyNewDec(0), }, { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(50), - stakerAmount: sdkmath.NewInt(51), - innerError: nil, - stakerShare: sdkmath.LegacyNewDec(51), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(50), + stakerAmount: sdkmath.NewInt(51), + innerError: nil, + stakerShare: sdkmath.LegacyNewDec(51), }, { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(50), - stakerAmount: sdkmath.NewInt(3), - innerError: nil, - stakerShare: sdkmath.LegacyNewDec(3), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(50), + stakerAmount: sdkmath.NewInt(3), + innerError: nil, + stakerShare: sdkmath.LegacyNewDec(3), }, { - totalShare: sdkmath.LegacyNewDec(50), - operatorAmount: sdkmath.NewInt(50), - stakerAmount: sdkmath.NewInt(50), - innerError: nil, - stakerShare: sdkmath.LegacyNewDec(50), + totalShare: sdkmath.LegacyNewDec(50), + totalAmount: sdkmath.NewInt(50), + stakerAmount: sdkmath.NewInt(50), + innerError: nil, + stakerShare: sdkmath.LegacyNewDec(50), }, // the share will be greater than the amount if there is a slash event { - totalShare: sdkmath.LegacyNewDec(70), - operatorAmount: sdkmath.NewInt(50), - stakerAmount: sdkmath.NewInt(0), - innerError: nil, - stakerShare: sdkmath.LegacyNewDec(0), + totalShare: sdkmath.LegacyNewDec(70), + totalAmount: sdkmath.NewInt(50), + stakerAmount: sdkmath.NewInt(0), + innerError: nil, + stakerShare: sdkmath.LegacyNewDec(0), + }, + { + totalShare: sdkmath.LegacyNewDec(70), + totalAmount: sdkmath.NewInt(50), + stakerAmount: sdkmath.NewInt(2), + innerError: nil, + stakerShare: sdkmath.LegacyMustNewDecFromStr("2.8"), }, { - totalShare: sdkmath.LegacyNewDec(70), - operatorAmount: sdkmath.NewInt(50), - stakerAmount: sdkmath.NewInt(2), - innerError: nil, - stakerShare: sdkmath.LegacyMustNewDecFromStr("2.8"), + totalShare: sdkmath.LegacyNewDec(70), + totalAmount: sdkmath.NewInt(50), + stakerAmount: sdkmath.NewInt(50), + innerError: nil, + stakerShare: sdkmath.LegacyNewDec(70), }, + + // all exit { - totalShare: sdkmath.LegacyNewDec(70), - operatorAmount: sdkmath.NewInt(50), - stakerAmount: sdkmath.NewInt(50), - innerError: nil, - stakerShare: sdkmath.LegacyNewDec(70), + totalShare: sdkmath.LegacyNewDec(0), + totalAmount: sdkmath.NewInt(0), + stakerAmount: sdkmath.NewInt(0), + innerError: nil, + stakerShare: sdkmath.LegacyNewDec(0), }, } for _, testCase := range testCases { - share, err := keeper.SharesFromTokens(testCase.totalShare, testCase.stakerAmount, testCase.operatorAmount) + share, err := keeper.SharesFromTokens(testCase.totalShare, testCase.stakerAmount, testCase.totalAmount) if testCase.innerError != nil { suite.ErrorContains(err, testCase.innerError.Error()) } else { @@ -189,6 +207,7 @@ func (suite *DelegationTestSuite) TestCalculateShare() { TotalAmount: sdkmath.NewInt(0), TotalShare: sdkmath.LegacyNewDec(0), }) + suite.NoError(err) share, err = suite.App.DelegationKeeper.CalculateShare(suite.Ctx, suite.opAccAddr, assetID, assetAmount) suite.NoError(err) suite.Equal(sdkmath.LegacyNewDecFromBigInt(assetAmount.BigInt()), share) @@ -198,6 +217,7 @@ func (suite *DelegationTestSuite) TestCalculateShare() { TotalAmount: sdkmath.NewInt(50), TotalShare: sdkmath.LegacyNewDec(60), }) + suite.NoError(err) share, err = suite.App.DelegationKeeper.CalculateShare(suite.Ctx, suite.opAccAddr, assetID, assetAmount) suite.NoError(err) suite.Equal(sdkmath.LegacyNewDec(12), share) @@ -209,17 +229,17 @@ func (suite *DelegationTestSuite) TestValidateUndelegationAmount() { stakerID, assetID := assetstype.GetStakeIDAndAssetID(suite.clientChainLzID, suite.Address[:], suite.assetAddr[:]) undelegationAmount := sdkmath.NewInt(0) - share, err := suite.App.DelegationKeeper.ValidateUndelegationAmount(suite.Ctx, suite.opAccAddr, stakerID, assetID, undelegationAmount) + _, err := suite.App.DelegationKeeper.ValidateUndelegationAmount(suite.Ctx, suite.opAccAddr, stakerID, assetID, undelegationAmount) suite.Error(err, delegationtypes.ErrAmountIsNotPositive) undelegationAmount = sdkmath.NewInt(10) - share, err = suite.App.DelegationKeeper.ValidateUndelegationAmount(suite.Ctx, suite.opAccAddr, stakerID, assetID, undelegationAmount) + share, err := suite.App.DelegationKeeper.ValidateUndelegationAmount(suite.Ctx, suite.opAccAddr, stakerID, assetID, undelegationAmount) suite.NoError(err) suite.Equal(sdkmath.LegacyNewDecFromBigInt(undelegationAmount.BigInt()), share) // test the undelegation amount is greater than the delegated amount undelegationAmount = suite.delegationAmount.Add(sdkmath.NewInt(1)) - share, err = suite.App.DelegationKeeper.ValidateUndelegationAmount(suite.Ctx, suite.opAccAddr, stakerID, assetID, undelegationAmount) + _, err = suite.App.DelegationKeeper.ValidateUndelegationAmount(suite.Ctx, suite.opAccAddr, stakerID, assetID, undelegationAmount) suite.Error(err, delegationtypes.ErrInsufficientShares) } diff --git a/x/delegation/types/genesis.go b/x/delegation/types/genesis.go index 571cb0c10..4171c2262 100644 --- a/x/delegation/types/genesis.go +++ b/x/delegation/types/genesis.go @@ -33,7 +33,9 @@ func (gs GenesisState) Validate() error { // validate staker ID var stakerClientChainID uint64 var err error - if _, stakerClientChainID, err = assetstypes.ValidateID(stakerID, true); err != nil { + if _, stakerClientChainID, err = assetstypes.ValidateID( + stakerID, true, true, + ); err != nil { return errorsmod.Wrapf( ErrInvalidGenesisData, "invalid staker ID %s: %s", stakerID, err, ) @@ -53,7 +55,9 @@ func (gs GenesisState) Validate() error { assets[assetID] = struct{}{} // validate asset ID var assetClientChainID uint64 - if _, assetClientChainID, err = assetstypes.ValidateID(assetID, true); err != nil { + if _, assetClientChainID, err = assetstypes.ValidateID( + assetID, true, true, + ); err != nil { return errorsmod.Wrapf( ErrInvalidGenesisData, "invalid asset ID %s: %s", assetID, err, ) diff --git a/x/delegation/types/keys.go b/x/delegation/types/keys.go index de8f5682f..9fb5ba84a 100644 --- a/x/delegation/types/keys.go +++ b/x/delegation/types/keys.go @@ -4,6 +4,7 @@ import ( "strings" assetstypes "github.com/ExocoreNetwork/exocore/x/assets/types" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -37,7 +38,7 @@ const ( prefixWaitCompleteUndelegations - // add for dogfood + // used to store the undelegation hold count prefixUndelegationOnHold ) @@ -74,6 +75,8 @@ func ParseStakerAssetIDAndOperatorAddrFromKey(key []byte) (keys *SingleDelegatio return &SingleDelegationInfoReq{StakerID: stringList[0], AssetID: stringList[1], OperatorAddr: stringList[2]}, nil } +// GetUndelegationRecordKey returns the key for the undelegation record. The caller must ensure that the parameters +// are valid; this function performs no validation whatsoever. func GetUndelegationRecordKey(blockHeight, lzNonce uint64, txHash string, operatorAddr string) []byte { return []byte(strings.Join([]string{operatorAddr, hexutil.EncodeUint64(blockHeight), hexutil.EncodeUint64(lzNonce), txHash}, "/")) } @@ -90,6 +93,10 @@ func ParseUndelegationRecordKey(key []byte) (field *UndelegationKeyFields, err e if err != nil { return nil, err } + operatorAccAddr, err := sdk.AccAddressFromBech32(stringList[0]) + if err != nil { + return nil, err + } height, err := hexutil.DecodeUint64(stringList[1]) if err != nil { return nil, err @@ -99,10 +106,11 @@ func ParseUndelegationRecordKey(key []byte) (field *UndelegationKeyFields, err e return nil, err } return &UndelegationKeyFields{ - OperatorAddr: stringList[0], + OperatorAddr: operatorAccAddr.String(), BlockHeight: height, LzNonce: lzNonce, - TxHash: stringList[3], + // TODO: validate the TxHash? + TxHash: stringList[3], }, nil } @@ -114,7 +122,7 @@ func GetWaitCompleteRecordKey(height, lzNonce uint64) []byte { return []byte(strings.Join([]string{hexutil.EncodeUint64(height), hexutil.EncodeUint64(lzNonce)}, "/")) } -// GetUndelegationOnHoldKey add for dogfood +// GetUndelegationOnHoldKey returns the key for the undelegation hold count func GetUndelegationOnHoldKey(recordKey []byte) []byte { return append([]byte{prefixUndelegationOnHold}, recordKey...) } diff --git a/x/delegation/types/query.pb.go b/x/delegation/types/query.pb.go index 9162decc3..d5b83e649 100644 --- a/x/delegation/types/query.pb.go +++ b/x/delegation/types/query.pb.go @@ -296,6 +296,98 @@ func (m *SingleDelegationInfoReq) GetAssetID() string { return "" } +// UndelegationHoldCountReq is the request to obtain the undelegation hold count. +type UndelegationHoldCountReq struct { + // record_key is the record key of the undelegation record. + RecordKey string `protobuf:"bytes,1,opt,name=record_key,json=recordKey,proto3" json:"record_key,omitempty"` +} + +func (m *UndelegationHoldCountReq) Reset() { *m = UndelegationHoldCountReq{} } +func (m *UndelegationHoldCountReq) String() string { return proto.CompactTextString(m) } +func (*UndelegationHoldCountReq) ProtoMessage() {} +func (*UndelegationHoldCountReq) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{5} +} +func (m *UndelegationHoldCountReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UndelegationHoldCountReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UndelegationHoldCountReq.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UndelegationHoldCountReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_UndelegationHoldCountReq.Merge(m, src) +} +func (m *UndelegationHoldCountReq) XXX_Size() int { + return m.Size() +} +func (m *UndelegationHoldCountReq) XXX_DiscardUnknown() { + xxx_messageInfo_UndelegationHoldCountReq.DiscardUnknown(m) +} + +var xxx_messageInfo_UndelegationHoldCountReq proto.InternalMessageInfo + +func (m *UndelegationHoldCountReq) GetRecordKey() string { + if m != nil { + return m.RecordKey + } + return "" +} + +// UndelegationHoldCountResponse is the response for the undelegation hold count. +type UndelegationHoldCountResponse struct { + // hold_count is the number of undelegations that are on hold. + HoldCount uint64 `protobuf:"varint,1,opt,name=hold_count,json=holdCount,proto3" json:"hold_count,omitempty"` +} + +func (m *UndelegationHoldCountResponse) Reset() { *m = UndelegationHoldCountResponse{} } +func (m *UndelegationHoldCountResponse) String() string { return proto.CompactTextString(m) } +func (*UndelegationHoldCountResponse) ProtoMessage() {} +func (*UndelegationHoldCountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{6} +} +func (m *UndelegationHoldCountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UndelegationHoldCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UndelegationHoldCountResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UndelegationHoldCountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_UndelegationHoldCountResponse.Merge(m, src) +} +func (m *UndelegationHoldCountResponse) XXX_Size() int { + return m.Size() +} +func (m *UndelegationHoldCountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_UndelegationHoldCountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_UndelegationHoldCountResponse proto.InternalMessageInfo + +func (m *UndelegationHoldCountResponse) GetHoldCount() uint64 { + if m != nil { + return m.HoldCount + } + return 0 +} + func init() { proto.RegisterType((*DelegationInfoReq)(nil), "exocore.delegation.v1.DelegationInfoReq") proto.RegisterType((*StakerList)(nil), "exocore.delegation.v1.StakerList") @@ -303,52 +395,60 @@ func init() { proto.RegisterType((*QueryDelegationInfoResponse)(nil), "exocore.delegation.v1.QueryDelegationInfoResponse") proto.RegisterMapType((map[string]*DelegationAmounts)(nil), "exocore.delegation.v1.QueryDelegationInfoResponse.DelegationInfosEntry") proto.RegisterType((*SingleDelegationInfoReq)(nil), "exocore.delegation.v1.SingleDelegationInfoReq") + proto.RegisterType((*UndelegationHoldCountReq)(nil), "exocore.delegation.v1.UndelegationHoldCountReq") + proto.RegisterType((*UndelegationHoldCountResponse)(nil), "exocore.delegation.v1.UndelegationHoldCountResponse") } func init() { proto.RegisterFile("exocore/delegation/v1/query.proto", fileDescriptor_aab345e1cf20490c) } var fileDescriptor_aab345e1cf20490c = []byte{ - // 637 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4f, 0x4f, 0x13, 0x41, - 0x1c, 0xed, 0x94, 0x20, 0x30, 0x60, 0xc4, 0x01, 0xb5, 0x14, 0xd3, 0xe2, 0x1e, 0x48, 0x25, 0x61, - 0x57, 0xaa, 0x26, 0xc6, 0x88, 0x09, 0xa4, 0x84, 0x6c, 0x62, 0x48, 0xdc, 0xc6, 0x8b, 0x97, 0xcd, - 0xd0, 0x1d, 0x96, 0x4d, 0xb7, 0x33, 0x65, 0x66, 0x5a, 0xe8, 0xd5, 0x93, 0x47, 0x13, 0xbf, 0x85, - 0x5e, 0x3c, 0xf0, 0x21, 0x38, 0x12, 0xbc, 0x18, 0x0f, 0x8d, 0x29, 0x26, 0x1e, 0xfc, 0x06, 0x5e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, 0xff, 0x10, 0x6e, 0xc3, 0x42, 0xa9, 0x05, 0x00, 0x00, + // 727 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x4f, 0x13, 0x4f, + 0x1c, 0xed, 0xf0, 0xe3, 0x0b, 0x1d, 0xf8, 0x46, 0x1c, 0x50, 0x4b, 0x91, 0x16, 0xf7, 0x40, 0x2a, + 0x09, 0xbb, 0x52, 0x31, 0x51, 0x23, 0x44, 0xb0, 0x04, 0x1b, 0x0c, 0x89, 0xdb, 0x78, 0xf1, 0xb2, + 0x59, 0xba, 0xc3, 0x76, 0xd3, 0xed, 0x4c, 0x99, 0x99, 0x16, 0x1a, 0xe3, 0xc5, 0x93, 0x47, 0x13, + 0xff, 0x0b, 0xbd, 0x78, 0xe0, 0xec, 0x99, 0x23, 0xc1, 0x8b, 0xf1, 0xd0, 0x98, 0x62, 0xe2, 0xff, + 0xe0, 0x45, 0xb3, 0xbb, 0x03, 0xdd, 0xe2, 0x2e, 0x4a, 0x3c, 0x75, 0xe7, 0xf3, 0xf3, 0xcd, 0x7b, + 0x2f, 0x53, 0x78, 0x03, 0xef, 0xd1, 0x32, 0x65, 0x58, 0xb3, 0xb0, 0x8b, 0x6d, 0x53, 0x38, 0x94, + 0x68, 0xcd, 0x05, 0x6d, 0xa7, 0x81, 0x59, 0x4b, 0xad, 0x33, 0x2a, 0x28, 0xba, 0x22, 0x4b, 0xd4, + 0x6e, 0x89, 0xda, 0x5c, 0x48, 0x4f, 0x95, 0x29, 0xaf, 0x51, 0x1e, 0x94, 0x9e, 0xe9, 0x49, 0x4f, + 0x06, 0x49, 0xc3, 0x3f, 0x69, 0xc1, 0x41, 0xa6, 0x26, 0x6c, 0x6a, 0xd3, 0x20, 0xee, 0x7d, 0xc9, + 0xe8, 0x75, 0x9b, 0x52, 0xdb, 0xc5, 0x9a, 0x59, 0x77, 0x34, 0x93, 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6, + 0xd3, 0x4d, 0x1e, 0xf7, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -368,6 +468,8 @@ type QueryClient interface { // SingleDelegationInfo queries the single delegation information for // {chain, staker, asset, operator}. QuerySingleDelegationInfo(ctx context.Context, in *SingleDelegationInfoReq, opts ...grpc.CallOption) (*DelegationAmounts, error) + // QueryUndelegationHoldCount queries the undelegation hold count. + QueryUndelegationHoldCount(ctx context.Context, in *UndelegationHoldCountReq, opts ...grpc.CallOption) (*UndelegationHoldCountResponse, error) } type queryClient struct { @@ -396,6 +498,15 @@ func (c *queryClient) QuerySingleDelegationInfo(ctx context.Context, in *SingleD return out, nil } +func (c *queryClient) QueryUndelegationHoldCount(ctx context.Context, in *UndelegationHoldCountReq, opts ...grpc.CallOption) (*UndelegationHoldCountResponse, error) { + out := new(UndelegationHoldCountResponse) + err := c.cc.Invoke(ctx, "/exocore.delegation.v1.Query/QueryUndelegationHoldCount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // DelegationInfo queries the delegation information for {stakerID, assetID}. @@ -403,6 +514,8 @@ type QueryServer interface { // SingleDelegationInfo queries the single delegation information for // {chain, staker, asset, operator}. QuerySingleDelegationInfo(context.Context, *SingleDelegationInfoReq) (*DelegationAmounts, error) + // QueryUndelegationHoldCount queries the undelegation hold count. + QueryUndelegationHoldCount(context.Context, *UndelegationHoldCountReq) (*UndelegationHoldCountResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -415,6 +528,9 @@ func (*UnimplementedQueryServer) QueryDelegationInfo(ctx context.Context, req *D func (*UnimplementedQueryServer) QuerySingleDelegationInfo(ctx context.Context, req *SingleDelegationInfoReq) (*DelegationAmounts, error) { return nil, status.Errorf(codes.Unimplemented, "method QuerySingleDelegationInfo not implemented") } +func (*UnimplementedQueryServer) QueryUndelegationHoldCount(ctx context.Context, req *UndelegationHoldCountReq) (*UndelegationHoldCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryUndelegationHoldCount not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -456,6 +572,24 @@ func _Query_QuerySingleDelegationInfo_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _Query_QueryUndelegationHoldCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UndelegationHoldCountReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryUndelegationHoldCount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.delegation.v1.Query/QueryUndelegationHoldCount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryUndelegationHoldCount(ctx, req.(*UndelegationHoldCountReq)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "exocore.delegation.v1.Query", HandlerType: (*QueryServer)(nil), @@ -468,6 +602,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QuerySingleDelegationInfo", Handler: _Query_QuerySingleDelegationInfo_Handler, }, + { + MethodName: "QueryUndelegationHoldCount", + Handler: _Query_QueryUndelegationHoldCount_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/delegation/v1/query.proto", @@ -678,6 +816,64 @@ func (m *SingleDelegationInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *UndelegationHoldCountReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UndelegationHoldCountReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UndelegationHoldCountReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RecordKey) > 0 { + i -= len(m.RecordKey) + copy(dAtA[i:], m.RecordKey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RecordKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UndelegationHoldCountResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UndelegationHoldCountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UndelegationHoldCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HoldCount != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.HoldCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -777,6 +973,31 @@ func (m *SingleDelegationInfoReq) Size() (n int) { return n } +func (m *UndelegationHoldCountReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RecordKey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *UndelegationHoldCountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HoldCount != 0 { + n += 1 + sovQuery(uint64(m.HoldCount)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1422,6 +1643,157 @@ func (m *SingleDelegationInfoReq) Unmarshal(dAtA []byte) error { } return nil } +func (m *UndelegationHoldCountReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UndelegationHoldCountReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UndelegationHoldCountReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordKey", 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.RecordKey = 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 *UndelegationHoldCountResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UndelegationHoldCountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UndelegationHoldCountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HoldCount", wireType) + } + m.HoldCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HoldCount |= 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 skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/delegation/types/query.pb.gw.go b/x/delegation/types/query.pb.gw.go index cbf25a404..dac6b2f70 100644 --- a/x/delegation/types/query.pb.gw.go +++ b/x/delegation/types/query.pb.gw.go @@ -105,6 +105,60 @@ func local_request_Query_QuerySingleDelegationInfo_0(ctx context.Context, marsha } +func request_Query_QueryUndelegationHoldCount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UndelegationHoldCountReq + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["record_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "record_key") + } + + protoReq.RecordKey, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "record_key", err) + } + + msg, err := client.QueryUndelegationHoldCount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryUndelegationHoldCount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UndelegationHoldCountReq + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["record_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "record_key") + } + + protoReq.RecordKey, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "record_key", err) + } + + msg, err := server.QueryUndelegationHoldCount(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -157,6 +211,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryUndelegationHoldCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryUndelegationHoldCount_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryUndelegationHoldCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -238,6 +315,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryUndelegationHoldCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryUndelegationHoldCount_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryUndelegationHoldCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -245,10 +342,14 @@ var ( pattern_Query_QueryDelegationInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "delegation", "v1", "GetDelegationInfo"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QuerySingleDelegationInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "delegation", "v1", "QuerySingleDelegationInfo"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryUndelegationHoldCount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "delegation", "v1", "QueryUndelegationHoldCount", "record_key"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_QueryDelegationInfo_0 = runtime.ForwardResponseMessage forward_Query_QuerySingleDelegationInfo_0 = runtime.ForwardResponseMessage + + forward_Query_QueryUndelegationHoldCount_0 = runtime.ForwardResponseMessage ) diff --git a/x/delegation/types/types/query.pb.go b/x/delegation/types/types/query.pb.go new file mode 100644 index 000000000..d5b83e649 --- /dev/null +++ b/x/delegation/types/types/query.pb.go @@ -0,0 +1,1880 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: exocore/delegation/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// DelegationInfoReq is the request to obtain the delegation information +// by staker id and asset id. +type DelegationInfoReq struct { + // staker_id is the staker id. + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + // asset_id is the asset id. + AssetID string `protobuf:"bytes,2,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` +} + +func (m *DelegationInfoReq) Reset() { *m = DelegationInfoReq{} } +func (m *DelegationInfoReq) String() string { return proto.CompactTextString(m) } +func (*DelegationInfoReq) ProtoMessage() {} +func (*DelegationInfoReq) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{0} +} +func (m *DelegationInfoReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationInfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationInfoReq.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DelegationInfoReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationInfoReq.Merge(m, src) +} +func (m *DelegationInfoReq) XXX_Size() int { + return m.Size() +} +func (m *DelegationInfoReq) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationInfoReq.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationInfoReq proto.InternalMessageInfo + +func (m *DelegationInfoReq) GetStakerID() string { + if m != nil { + return m.StakerID + } + return "" +} + +func (m *DelegationInfoReq) GetAssetID() string { + if m != nil { + return m.AssetID + } + return "" +} + +// StakerList is a list to save a batch of stakers +type StakerList struct { + // stakers is a list of stakers. the caller is responsible for ensuring + // uniqueness of the stakers, since dumping this into a map could lead + // to non-deterministic behavior. + Stakers []string `protobuf:"bytes,1,rep,name=stakers,proto3" json:"stakers,omitempty"` +} + +func (m *StakerList) Reset() { *m = StakerList{} } +func (m *StakerList) String() string { return proto.CompactTextString(m) } +func (*StakerList) ProtoMessage() {} +func (*StakerList) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{1} +} +func (m *StakerList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StakerList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StakerList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StakerList) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakerList.Merge(m, src) +} +func (m *StakerList) XXX_Size() int { + return m.Size() +} +func (m *StakerList) XXX_DiscardUnknown() { + xxx_messageInfo_StakerList.DiscardUnknown(m) +} + +var xxx_messageInfo_StakerList proto.InternalMessageInfo + +func (m *StakerList) GetStakers() []string { + if m != nil { + return m.Stakers + } + return nil +} + +// DelegationAmounts is the delegation amount response for a single delegation. +type DelegationAmounts struct { + // undelegatable_share is the share that can be undelegated. + // It's to reduce the state updating when slash occurs. + // S_j = S * T_j / T, `S` and `T` is the current asset share and amount of operator, + // and the T_j represents the change in staker's asset amount when some external + // operations occur, such as: delegation, undelegation and non-instantaneous slashing. + // S_j represents the change in the staker's asset share, + // so the updated share should be added by it. + // A special case is the initial delegation, when T = 0 and S = 0, so T_j / T is undefined. + // For the initial delegation, delegator j who delegates T_j tokens receive S_j = T_j shares. + UndelegatableShare github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=undelegatable_share,json=undelegatableShare,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"undelegatable_share"` + // wait_undelegation_amount is the amount that is waiting to be unbonded. + WaitUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=wait_undelegation_amount,json=waitUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount"` +} + +func (m *DelegationAmounts) Reset() { *m = DelegationAmounts{} } +func (m *DelegationAmounts) String() string { return proto.CompactTextString(m) } +func (*DelegationAmounts) ProtoMessage() {} +func (*DelegationAmounts) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{2} +} +func (m *DelegationAmounts) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationAmounts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationAmounts.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DelegationAmounts) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationAmounts.Merge(m, src) +} +func (m *DelegationAmounts) XXX_Size() int { + return m.Size() +} +func (m *DelegationAmounts) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationAmounts.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationAmounts proto.InternalMessageInfo + +// QueryDelegationInfoResponse is the response for delegations by staker id and +// asset id. +type QueryDelegationInfoResponse struct { + // delegation_infos is the delegation information for each operator. + DelegationInfos map[string]*DelegationAmounts `protobuf:"bytes,1,rep,name=delegation_infos,json=delegationInfos,proto3" json:"delegation_infos,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *QueryDelegationInfoResponse) Reset() { *m = QueryDelegationInfoResponse{} } +func (m *QueryDelegationInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegationInfoResponse) ProtoMessage() {} +func (*QueryDelegationInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{3} +} +func (m *QueryDelegationInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegationInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegationInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryDelegationInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegationInfoResponse.Merge(m, src) +} +func (m *QueryDelegationInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegationInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegationInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegationInfoResponse proto.InternalMessageInfo + +func (m *QueryDelegationInfoResponse) GetDelegationInfos() map[string]*DelegationAmounts { + if m != nil { + return m.DelegationInfos + } + return nil +} + +// SingleDelegationInfoReq is the request to obtain the single delegation information. +type SingleDelegationInfoReq struct { + // staker_id is the staker id. + StakerID string `protobuf:"bytes,1,opt,name=staker_id,json=stakerId,proto3" json:"staker_id,omitempty"` + // operator_addr is the operator address. + OperatorAddr string `protobuf:"bytes,2,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` + // asset_id is the asset id. + AssetID string `protobuf:"bytes,3,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` +} + +func (m *SingleDelegationInfoReq) Reset() { *m = SingleDelegationInfoReq{} } +func (m *SingleDelegationInfoReq) String() string { return proto.CompactTextString(m) } +func (*SingleDelegationInfoReq) ProtoMessage() {} +func (*SingleDelegationInfoReq) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{4} +} +func (m *SingleDelegationInfoReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SingleDelegationInfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SingleDelegationInfoReq.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SingleDelegationInfoReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_SingleDelegationInfoReq.Merge(m, src) +} +func (m *SingleDelegationInfoReq) XXX_Size() int { + return m.Size() +} +func (m *SingleDelegationInfoReq) XXX_DiscardUnknown() { + xxx_messageInfo_SingleDelegationInfoReq.DiscardUnknown(m) +} + +var xxx_messageInfo_SingleDelegationInfoReq proto.InternalMessageInfo + +func (m *SingleDelegationInfoReq) GetStakerID() string { + if m != nil { + return m.StakerID + } + return "" +} + +func (m *SingleDelegationInfoReq) GetOperatorAddr() string { + if m != nil { + return m.OperatorAddr + } + return "" +} + +func (m *SingleDelegationInfoReq) GetAssetID() string { + if m != nil { + return m.AssetID + } + return "" +} + +// UndelegationHoldCountReq is the request to obtain the undelegation hold count. +type UndelegationHoldCountReq struct { + // record_key is the record key of the undelegation record. + RecordKey string `protobuf:"bytes,1,opt,name=record_key,json=recordKey,proto3" json:"record_key,omitempty"` +} + +func (m *UndelegationHoldCountReq) Reset() { *m = UndelegationHoldCountReq{} } +func (m *UndelegationHoldCountReq) String() string { return proto.CompactTextString(m) } +func (*UndelegationHoldCountReq) ProtoMessage() {} +func (*UndelegationHoldCountReq) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{5} +} +func (m *UndelegationHoldCountReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UndelegationHoldCountReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UndelegationHoldCountReq.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UndelegationHoldCountReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_UndelegationHoldCountReq.Merge(m, src) +} +func (m *UndelegationHoldCountReq) XXX_Size() int { + return m.Size() +} +func (m *UndelegationHoldCountReq) XXX_DiscardUnknown() { + xxx_messageInfo_UndelegationHoldCountReq.DiscardUnknown(m) +} + +var xxx_messageInfo_UndelegationHoldCountReq proto.InternalMessageInfo + +func (m *UndelegationHoldCountReq) GetRecordKey() string { + if m != nil { + return m.RecordKey + } + return "" +} + +// UndelegationHoldCountResponse is the response for the undelegation hold count. +type UndelegationHoldCountResponse struct { + // hold_count is the number of undelegations that are on hold. + HoldCount uint64 `protobuf:"varint,1,opt,name=hold_count,json=holdCount,proto3" json:"hold_count,omitempty"` +} + +func (m *UndelegationHoldCountResponse) Reset() { *m = UndelegationHoldCountResponse{} } +func (m *UndelegationHoldCountResponse) String() string { return proto.CompactTextString(m) } +func (*UndelegationHoldCountResponse) ProtoMessage() {} +func (*UndelegationHoldCountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_aab345e1cf20490c, []int{6} +} +func (m *UndelegationHoldCountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UndelegationHoldCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UndelegationHoldCountResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UndelegationHoldCountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_UndelegationHoldCountResponse.Merge(m, src) +} +func (m *UndelegationHoldCountResponse) XXX_Size() int { + return m.Size() +} +func (m *UndelegationHoldCountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_UndelegationHoldCountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_UndelegationHoldCountResponse proto.InternalMessageInfo + +func (m *UndelegationHoldCountResponse) GetHoldCount() uint64 { + if m != nil { + return m.HoldCount + } + return 0 +} + +func init() { + proto.RegisterType((*DelegationInfoReq)(nil), "exocore.delegation.v1.DelegationInfoReq") + proto.RegisterType((*StakerList)(nil), "exocore.delegation.v1.StakerList") + proto.RegisterType((*DelegationAmounts)(nil), "exocore.delegation.v1.DelegationAmounts") + proto.RegisterType((*QueryDelegationInfoResponse)(nil), "exocore.delegation.v1.QueryDelegationInfoResponse") + proto.RegisterMapType((map[string]*DelegationAmounts)(nil), "exocore.delegation.v1.QueryDelegationInfoResponse.DelegationInfosEntry") + proto.RegisterType((*SingleDelegationInfoReq)(nil), "exocore.delegation.v1.SingleDelegationInfoReq") + proto.RegisterType((*UndelegationHoldCountReq)(nil), "exocore.delegation.v1.UndelegationHoldCountReq") + proto.RegisterType((*UndelegationHoldCountResponse)(nil), "exocore.delegation.v1.UndelegationHoldCountResponse") +} + +func init() { proto.RegisterFile("exocore/delegation/v1/query.proto", fileDescriptor_aab345e1cf20490c) } + +var fileDescriptor_aab345e1cf20490c = []byte{ + // 727 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x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d, + 0x71, 0xd1, 0x3b, 0x00, 0xc7, 0x23, 0x64, 0x46, 0x7f, 0xe6, 0x5f, 0x12, 0x9b, 0xce, 0x5f, 0xdc, + 0x3c, 0xca, 0x9d, 0xd7, 0xdf, 0x3f, 0xcc, 0x81, 0x57, 0x9f, 0xbe, 0xbd, 0xed, 0x9b, 0x43, 0x39, + 0x2d, 0xfa, 0xad, 0x5b, 0xc7, 0xe2, 0x0c, 0xa8, 0x7d, 0x00, 0x27, 0xfd, 0xb1, 0x51, 0x22, 0x23, + 0x35, 0x06, 0x48, 0x8c, 0x23, 0xd2, 0x7f, 0x6d, 0x31, 0x65, 0xa9, 0x0b, 0x37, 0x8f, 0x6e, 0xc5, + 0xc0, 0x8d, 0x07, 0x76, 0x08, 0x60, 0xda, 0xcf, 0x46, 0x6a, 0x86, 0xb4, 0x18, 0x1c, 0x71, 0xe6, + 0x48, 0x2f, 0x5e, 0xac, 0x41, 0x72, 0xbe, 0xd1, 0xbd, 0xc4, 0x43, 0xb4, 0x7c, 0xde, 0x25, 0x22, + 0xe7, 0x68, 0x2f, 0xba, 0x86, 0x7c, 0xb9, 0xba, 0x79, 0xd0, 0xc9, 0x80, 0xc3, 0x4e, 0x06, 0x7c, + 0xed, 0x64, 0xc0, 0x9b, 0xe3, 0x4c, 0xe2, 0xf0, 0x38, 0x93, 0xf8, 0x7c, 0x9c, 0x49, 0x3c, 0x5f, + 0x0c, 0xbd, 0x69, 0x6b, 0xc1, 0x8e, 0x4d, 0x2c, 0x76, 0x29, 0xab, 0x9e, 0xae, 0xdc, 0x0b, 0x2f, + 0xf5, 0x5f, 0xb9, 0xad, 0xff, 0xfc, 0xff, 0x93, 0xdb, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd6, + 0xd3, 0x4d, 0x1e, 0xf7, 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 { + // DelegationInfo queries the delegation information for {stakerID, assetID}. + QueryDelegationInfo(ctx context.Context, in *DelegationInfoReq, opts ...grpc.CallOption) (*QueryDelegationInfoResponse, error) + // SingleDelegationInfo queries the single delegation information for + // {chain, staker, asset, operator}. + QuerySingleDelegationInfo(ctx context.Context, in *SingleDelegationInfoReq, opts ...grpc.CallOption) (*DelegationAmounts, error) + // QueryUndelegationHoldCount queries the undelegation hold count. + QueryUndelegationHoldCount(ctx context.Context, in *UndelegationHoldCountReq, opts ...grpc.CallOption) (*UndelegationHoldCountResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) QueryDelegationInfo(ctx context.Context, in *DelegationInfoReq, opts ...grpc.CallOption) (*QueryDelegationInfoResponse, error) { + out := new(QueryDelegationInfoResponse) + err := c.cc.Invoke(ctx, "/exocore.delegation.v1.Query/QueryDelegationInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QuerySingleDelegationInfo(ctx context.Context, in *SingleDelegationInfoReq, opts ...grpc.CallOption) (*DelegationAmounts, error) { + out := new(DelegationAmounts) + err := c.cc.Invoke(ctx, "/exocore.delegation.v1.Query/QuerySingleDelegationInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryUndelegationHoldCount(ctx context.Context, in *UndelegationHoldCountReq, opts ...grpc.CallOption) (*UndelegationHoldCountResponse, error) { + out := new(UndelegationHoldCountResponse) + err := c.cc.Invoke(ctx, "/exocore.delegation.v1.Query/QueryUndelegationHoldCount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // DelegationInfo queries the delegation information for {stakerID, assetID}. + QueryDelegationInfo(context.Context, *DelegationInfoReq) (*QueryDelegationInfoResponse, error) + // SingleDelegationInfo queries the single delegation information for + // {chain, staker, asset, operator}. + QuerySingleDelegationInfo(context.Context, *SingleDelegationInfoReq) (*DelegationAmounts, error) + // QueryUndelegationHoldCount queries the undelegation hold count. + QueryUndelegationHoldCount(context.Context, *UndelegationHoldCountReq) (*UndelegationHoldCountResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) QueryDelegationInfo(ctx context.Context, req *DelegationInfoReq) (*QueryDelegationInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryDelegationInfo not implemented") +} +func (*UnimplementedQueryServer) QuerySingleDelegationInfo(ctx context.Context, req *SingleDelegationInfoReq) (*DelegationAmounts, error) { + return nil, status.Errorf(codes.Unimplemented, "method QuerySingleDelegationInfo not implemented") +} +func (*UnimplementedQueryServer) QueryUndelegationHoldCount(ctx context.Context, req *UndelegationHoldCountReq) (*UndelegationHoldCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryUndelegationHoldCount not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_QueryDelegationInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DelegationInfoReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryDelegationInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.delegation.v1.Query/QueryDelegationInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryDelegationInfo(ctx, req.(*DelegationInfoReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QuerySingleDelegationInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SingleDelegationInfoReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QuerySingleDelegationInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.delegation.v1.Query/QuerySingleDelegationInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QuerySingleDelegationInfo(ctx, req.(*SingleDelegationInfoReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryUndelegationHoldCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UndelegationHoldCountReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryUndelegationHoldCount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.delegation.v1.Query/QueryUndelegationHoldCount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryUndelegationHoldCount(ctx, req.(*UndelegationHoldCountReq)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "exocore.delegation.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "QueryDelegationInfo", + Handler: _Query_QueryDelegationInfo_Handler, + }, + { + MethodName: "QuerySingleDelegationInfo", + Handler: _Query_QuerySingleDelegationInfo_Handler, + }, + { + MethodName: "QueryUndelegationHoldCount", + Handler: _Query_QueryUndelegationHoldCount_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "exocore/delegation/v1/query.proto", +} + +func (m *DelegationInfoReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DelegationInfoReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetID))) + i-- + dAtA[i] = 0x12 + } + if len(m.StakerID) > 0 { + i -= len(m.StakerID) + copy(dAtA[i:], m.StakerID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StakerList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StakerList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StakerList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Stakers) > 0 { + for iNdEx := len(m.Stakers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Stakers[iNdEx]) + copy(dAtA[i:], m.Stakers[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Stakers[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *DelegationAmounts) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DelegationAmounts) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationAmounts) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.WaitUndelegationAmount.Size() + i -= size + if _, err := m.WaitUndelegationAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.UndelegatableShare.Size() + i -= size + if _, err := m.UndelegatableShare.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryDelegationInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDelegationInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegationInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DelegationInfos) > 0 { + for k := range m.DelegationInfos { + v := m.DelegationInfos[k] + baseI := i + if v != nil { + { + size, err := v.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintQuery(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintQuery(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *SingleDelegationInfoReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SingleDelegationInfoReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SingleDelegationInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetID))) + i-- + dAtA[i] = 0x1a + } + if len(m.OperatorAddr) > 0 { + i -= len(m.OperatorAddr) + copy(dAtA[i:], m.OperatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.StakerID) > 0 { + i -= len(m.StakerID) + copy(dAtA[i:], m.StakerID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UndelegationHoldCountReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UndelegationHoldCountReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UndelegationHoldCountReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RecordKey) > 0 { + i -= len(m.RecordKey) + copy(dAtA[i:], m.RecordKey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RecordKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UndelegationHoldCountResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UndelegationHoldCountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UndelegationHoldCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HoldCount != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.HoldCount)) + i-- + dAtA[i] = 0x8 + } + 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 *DelegationInfoReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StakerID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.AssetID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *StakerList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Stakers) > 0 { + for _, s := range m.Stakers { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *DelegationAmounts) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.UndelegatableShare.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.WaitUndelegationAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDelegationInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DelegationInfos) > 0 { + for k, v := range m.DelegationInfos { + _ = k + _ = v + l = 0 + if v != nil { + l = v.Size() + l += 1 + sovQuery(uint64(l)) + } + mapEntrySize := 1 + len(k) + sovQuery(uint64(len(k))) + l + n += mapEntrySize + 1 + sovQuery(uint64(mapEntrySize)) + } + } + return n +} + +func (m *SingleDelegationInfoReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StakerID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OperatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.AssetID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *UndelegationHoldCountReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RecordKey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *UndelegationHoldCountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HoldCount != 0 { + n += 1 + sovQuery(uint64(m.HoldCount)) + } + 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 *DelegationInfoReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DelegationInfoReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakerID", 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.StakerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", 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.AssetID = 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 *StakerList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StakerList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StakerList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stakers", 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.Stakers = append(m.Stakers, 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 *DelegationAmounts) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DelegationAmounts: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationAmounts: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UndelegatableShare", 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 + } + if err := m.UndelegatableShare.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WaitUndelegationAmount", 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 + } + if err := m.WaitUndelegationAmount.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 *QueryDelegationInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryDelegationInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegationInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationInfos", 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.DelegationInfos == nil { + m.DelegationInfos = make(map[string]*DelegationAmounts) + } + var mapkey string + var mapvalue *DelegationAmounts + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthQuery + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthQuery + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthQuery + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthQuery + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &DelegationAmounts{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.DelegationInfos[mapkey] = mapvalue + 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 *SingleDelegationInfoReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SingleDelegationInfoReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SingleDelegationInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakerID", 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.StakerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddr", 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.OperatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", 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.AssetID = 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 *UndelegationHoldCountReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UndelegationHoldCountReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UndelegationHoldCountReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordKey", 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.RecordKey = 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 *UndelegationHoldCountResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UndelegationHoldCountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UndelegationHoldCountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HoldCount", wireType) + } + m.HoldCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HoldCount |= 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 skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/delegation/types/types/query.pb.gw.go b/x/delegation/types/types/query.pb.gw.go new file mode 100644 index 000000000..dac6b2f70 --- /dev/null +++ b/x/delegation/types/types/query.pb.gw.go @@ -0,0 +1,355 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: exocore/delegation/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_Query_QueryDelegationInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_QueryDelegationInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DelegationInfoReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryDelegationInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryDelegationInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryDelegationInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DelegationInfoReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryDelegationInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryDelegationInfo(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QuerySingleDelegationInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_QuerySingleDelegationInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SingleDelegationInfoReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QuerySingleDelegationInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QuerySingleDelegationInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QuerySingleDelegationInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SingleDelegationInfoReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QuerySingleDelegationInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QuerySingleDelegationInfo(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryUndelegationHoldCount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UndelegationHoldCountReq + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["record_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "record_key") + } + + protoReq.RecordKey, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "record_key", err) + } + + msg, err := client.QueryUndelegationHoldCount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryUndelegationHoldCount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UndelegationHoldCountReq + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["record_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "record_key") + } + + protoReq.RecordKey, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "record_key", err) + } + + msg, err := server.QueryUndelegationHoldCount(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_QueryDelegationInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryDelegationInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryDelegationInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QuerySingleDelegationInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QuerySingleDelegationInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QuerySingleDelegationInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryUndelegationHoldCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryUndelegationHoldCount_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryUndelegationHoldCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_QueryDelegationInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryDelegationInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryDelegationInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QuerySingleDelegationInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QuerySingleDelegationInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QuerySingleDelegationInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryUndelegationHoldCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryUndelegationHoldCount_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryUndelegationHoldCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_QueryDelegationInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "delegation", "v1", "GetDelegationInfo"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QuerySingleDelegationInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "delegation", "v1", "QuerySingleDelegationInfo"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryUndelegationHoldCount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "delegation", "v1", "QueryUndelegationHoldCount", "record_key"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_QueryDelegationInfo_0 = runtime.ForwardResponseMessage + + forward_Query_QuerySingleDelegationInfo_0 = runtime.ForwardResponseMessage + + forward_Query_QueryUndelegationHoldCount_0 = runtime.ForwardResponseMessage +) diff --git a/x/dogfood/client/cli/query.go b/x/dogfood/client/cli/query.go index eac3ceae4..0749c6d0d 100644 --- a/x/dogfood/client/cli/query.go +++ b/x/dogfood/client/cli/query.go @@ -2,16 +2,13 @@ package cli import ( "fmt" - // "strings" + "strconv" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ExocoreNetwork/exocore/x/dogfood/types" ) @@ -30,6 +27,11 @@ func GetQueryCmd(string) *cobra.Command { } cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdQueryOptOutsToFinish()) + cmd.AddCommand(CmdQueryOperatorOptOutFinishEpoch()) + cmd.AddCommand(CmdQueryUndelegationsToMature()) + cmd.AddCommand(CmdQueryUndelegationMaturityEpoch()) + cmd.AddCommand(CmdQueryValidator()) return cmd } @@ -60,3 +62,151 @@ func CmdQueryParams() *cobra.Command { return cmd } + +func CmdQueryOptOutsToFinish() *cobra.Command { + cmd := &cobra.Command{ + Use: "opt-outs-to-finish [epoch]", + Short: "shows the operator addresses whose opt out matures at the provided epoch", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + epoch := args[0] + cEpoch, err := strconv.ParseInt(epoch, 10, 64) + if err != nil { + return err + } + res, err := queryClient.OptOutsToFinish( + cmd.Context(), &types.QueryOptOutsToFinishRequest{Epoch: cEpoch}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryOperatorOptOutFinishEpoch() *cobra.Command { + cmd := &cobra.Command{ + Use: "operator-opt-out-finish-epoch [operator]", + Short: "shows the epoch at which an operator's opt out will be finished", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + operator := args[0] + res, err := queryClient.OperatorOptOutFinishEpoch( + cmd.Context(), &types.QueryOperatorOptOutFinishEpochRequest{ + OperatorAccAddr: operator, + }, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryUndelegationsToMature() *cobra.Command { + cmd := &cobra.Command{ + Use: "undelegations-to-mature [epoch]", + Short: "shows the undelegations that will mature at the provided epoch", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + epoch := args[0] + cEpoch, err := strconv.ParseInt(epoch, 10, 64) + if err != nil { + return err + } + res, err := queryClient.UndelegationsToMature( + cmd.Context(), &types.QueryUndelegationsToMatureRequest{Epoch: cEpoch}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryUndelegationMaturityEpoch() *cobra.Command { + cmd := &cobra.Command{ + Use: "undelegation-maturity-epoch [recordKey]", + Short: "shows the epoch at which an undelegation record will be mature", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + recordKey := args[0] + res, err := queryClient.UndelegationMaturityEpoch( + cmd.Context(), &types.QueryUndelegationMaturityEpochRequest{RecordKey: recordKey}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryValidator() *cobra.Command { + cmd := &cobra.Command{ + Use: "validator [consensus-address]", + Short: "shows the validator information for the provided consensus address", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + address := args[0] + res, err := queryClient.QueryValidator( + cmd.Context(), &types.QueryValidatorRequest{ConsAddr: address}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/dogfood/keeper/abci.go b/x/dogfood/keeper/abci.go index c770e64d3..a2c8b7295 100644 --- a/x/dogfood/keeper/abci.go +++ b/x/dogfood/keeper/abci.go @@ -22,19 +22,25 @@ func (k Keeper) EndBlock(ctx sdk.Context) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } defer k.ClearEpochEnd(ctx) - // start with clearing the hold on the undelegations. + // start by clearing the previous consensus keys for the chain. + // each AVS can have a separate epoch and hence this function is a part of this module + // and not the operator module. + k.operatorKeeper.ClearPreviousConsensusKeys(ctx, ctx.ChainID()) + // clear the hold on the pending undelegations. undelegations := k.GetPendingUndelegations(ctx) for _, undelegation := range undelegations.GetList() { err := k.delegationKeeper.DecrementUndelegationHoldCount(ctx, undelegation) if err != nil { panic(err) } + k.ClearUndelegationMaturityEpoch(ctx, undelegation) } k.ClearPendingUndelegations(ctx) // then, let the operator module know that the opt out has finished. optOuts := k.GetPendingOptOuts(ctx) for _, addr := range optOuts.GetList() { - k.operatorKeeper.CompleteOperatorOptOutFromChainID(ctx, addr, ctx.ChainID()) + // TODO log the error + _ = k.operatorKeeper.CompleteOperatorKeyRemovalForChainID(ctx, addr, ctx.ChainID()) } k.ClearPendingOptOuts(ctx) // for slashing, the operator module is required to store a mapping of chain id + cons addr diff --git a/x/dogfood/keeper/genesis.go b/x/dogfood/keeper/genesis.go index d00906cce..4d4557d93 100644 --- a/x/dogfood/keeper/genesis.go +++ b/x/dogfood/keeper/genesis.go @@ -6,7 +6,10 @@ import ( "github.com/ExocoreNetwork/exocore/x/dogfood/types" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" abci "github.com/cometbft/cometbft/abci/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/ethereum/go-ethereum/common/hexutil" ) // InitGenesis initializes the module's state from a provided genesis state. @@ -19,7 +22,7 @@ func (k Keeper) InitGenesis( // so, it must be done here. by extension, the `InitGenesis` of the epochs module // should be called before that of this module. epochID := genState.Params.EpochIdentifier - _, found := k.epochsKeeper.GetEpochInfo(ctx, epochID) + epochInfo, found := k.epochsKeeper.GetEpochInfo(ctx, epochID) if !found { // the panic is suitable here because it is being done at genesis, when the node // is not running. it means that the genesis file is malformed. @@ -35,9 +38,8 @@ func (k Keeper) InitGenesis( // validator. this is because the operator may not have enough minimum self delegation // to be considered, or may not be in the top N operators. so checking that count here // is meaningless as well. - totalPower := sdk.NewInt(0) - out := make([]abci.ValidatorUpdate, len(genState.InitialValSet)) - for _, val := range genState.InitialValSet { + out := make([]abci.ValidatorUpdate, 0, len(genState.ValSet)) + for _, val := range genState.ValSet { // #nosec G703 // already validated consKey, _ := operatortypes.HexStringToPubKey(val.PublicKey) // #nosec G703 // this only fails if the key is of a type not already defined. @@ -55,9 +57,47 @@ func (k Keeper) InitGenesis( PubKey: *consKey, Power: val.Power, }) - totalPower = totalPower.Add(sdk.NewInt(val.Power)) } - k.SetLastTotalPower(ctx, totalPower) + for i := range genState.OptOutExpiries { + obj := genState.OptOutExpiries[i] + epoch := obj.Epoch + if epoch < epochInfo.CurrentEpoch { + panic(fmt.Sprintf("epoch %d is in the past", epoch)) + } + for _, addr := range obj.OperatorAccAddrs { + // #nosec G703 // already validated + operatorAddr, _ := sdk.AccAddressFromBech32(addr) + k.AppendOptOutToFinish(ctx, epoch, operatorAddr) + k.SetOperatorOptOutFinishEpoch(ctx, operatorAddr, epoch) + } + } + for i := range genState.ConsensusAddrsToPrune { + obj := genState.ConsensusAddrsToPrune[i] + epoch := obj.Epoch + if epoch < epochInfo.CurrentEpoch { + panic(fmt.Sprintf("epoch %d is in the past", epoch)) + } + for _, addr := range obj.ConsAddrs { + // #nosec G703 // already validated + accAddr, _ := sdk.ConsAddressFromBech32(addr) + k.AppendConsensusAddrToPrune(ctx, epoch, accAddr) + } + } + for i := range genState.UndelegationMaturities { + obj := genState.UndelegationMaturities[i] + epoch := obj.Epoch + if epoch < epochInfo.CurrentEpoch { + panic(fmt.Sprintf("epoch %d is in the past", epoch)) + } + for _, recordKey := range obj.UndelegationRecordKeys { + // #nosec G703 // already validated + recordKeyBytes, _ := hexutil.Decode(recordKey) + k.AppendUndelegationToMature(ctx, epoch, recordKeyBytes) + k.SetUndelegationMaturityEpoch(ctx, recordKeyBytes, epoch) + } + } + // ApplyValidatorChanges only gets changes and hence the vote power must be set here. + k.SetLastTotalPower(ctx, genState.LastTotalPower) // ApplyValidatorChanges will sort it internally return k.ApplyValidatorChanges( @@ -69,6 +109,26 @@ func (k Keeper) InitGenesis( func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetDogfoodParams(ctx) - // TODO(mm) - return genesis + validators := []types.GenesisValidator{} + k.IterateBondedValidatorsByPower(ctx, func(_ int64, val stakingtypes.ValidatorI) bool { + // #nosec G703 // already validated + pubKey, _ := val.ConsPubKey() + // #nosec G703 // already validated + convKey, _ := cryptocodec.ToTmPubKeyInterface(pubKey) + validators = append(validators, + types.GenesisValidator{ + PublicKey: hexutil.Encode(convKey.Bytes()), + Power: val.GetConsensusPower(sdk.DefaultPowerReduction), + }, + ) + return false /* stop */ + }) + return types.NewGenesis( + k.GetDogfoodParams(ctx), + validators, + k.GetAllOptOutsToFinish(ctx), + k.GetAllConsAddrsToPrune(ctx), + k.GetAllUndelegationsToMature(ctx), + k.GetLastTotalPower(ctx), + ) } diff --git a/x/dogfood/keeper/impl_delegation_hooks.go b/x/dogfood/keeper/impl_delegation_hooks.go index 1d9f278aa..1a6103a01 100644 --- a/x/dogfood/keeper/impl_delegation_hooks.go +++ b/x/dogfood/keeper/impl_delegation_hooks.go @@ -34,7 +34,7 @@ func (wrapper DelegationHooksWrapper) AfterUndelegationStarted( ctx sdk.Context, operator sdk.AccAddress, recordKey []byte, ) error { var unbondingCompletionEpoch int64 - if wrapper.keeper.operatorKeeper.IsOperatorOptingOutFromChainID( + if wrapper.keeper.operatorKeeper.IsOperatorRemovingKeyFromChainID( ctx, operator, ctx.ChainID(), ) { // if the operator is opting out, we need to use the finish epoch of the opt out. @@ -49,5 +49,6 @@ func (wrapper DelegationHooksWrapper) AfterUndelegationStarted( // so this is not a concern. } wrapper.keeper.AppendUndelegationToMature(ctx, unbondingCompletionEpoch, recordKey) + wrapper.keeper.SetUndelegationMaturityEpoch(ctx, recordKey, unbondingCompletionEpoch) return wrapper.keeper.delegationKeeper.IncrementUndelegationHoldCount(ctx, recordKey) } diff --git a/x/dogfood/keeper/impl_epochs_hooks.go b/x/dogfood/keeper/impl_epochs_hooks.go index 8d520bf16..3271707b4 100644 --- a/x/dogfood/keeper/impl_epochs_hooks.go +++ b/x/dogfood/keeper/impl_epochs_hooks.go @@ -37,6 +37,9 @@ func (wrapper EpochsHooksWrapper) AfterEpochEnd( // find the opt outs that mature when this epoch ends, and move them to pending. optOuts := wrapper.keeper.GetOptOutsToFinish(ctx, epoch) wrapper.keeper.SetPendingOptOuts(ctx, types.AccountAddresses{List: optOuts}) + for _, addr := range optOuts { + wrapper.keeper.DeleteOperatorOptOutFinishEpoch(ctx, addr) + } wrapper.keeper.ClearOptOutsToFinish(ctx, epoch) // next, find the consensus addresses that are to be pruned, and move them to pending. consAddresses := wrapper.keeper.GetConsensusAddrsToPrune(ctx, epoch) diff --git a/x/dogfood/keeper/impl_operator_hooks.go b/x/dogfood/keeper/impl_operator_hooks.go index ed6d316c5..769c773b2 100644 --- a/x/dogfood/keeper/impl_operator_hooks.go +++ b/x/dogfood/keeper/impl_operator_hooks.go @@ -1,8 +1,6 @@ package keeper import ( - "strings" - operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,36 +19,56 @@ func (k *Keeper) OperatorHooks() OperatorHooksWrapper { return OperatorHooksWrapper{k} } -// AfterOperatorOptIn is the implementation of the operator hooks. -func (h OperatorHooksWrapper) AfterOperatorOptIn( - ctx sdk.Context, addr sdk.AccAddress, chainID string, key *tmprotocrypto.PublicKey, +// AfterOperatorKeySet is the implementation of the operator hooks. +// CONTRACT: an operator cannot set their key if they are already in the process of removing it. +func (h OperatorHooksWrapper) AfterOperatorKeySet( + sdk.Context, sdk.AccAddress, string, *tmprotocrypto.PublicKey, ) { // an operator opting in does not meaningfully affect this module, since // this information will be fetched at the end of the epoch // and the operator's vote power will be calculated then. - // however, we will still clear the unbonding information, if it exists. - if strings.Compare(chainID, ctx.ChainID()) == 0 { - h.keeper.ClearUnbondingInformation(ctx, addr, key) - } } -// AfterOperatorKeyReplacement is the implementation of the operator hooks. -func (h OperatorHooksWrapper) AfterOperatorKeyReplacement( - ctx sdk.Context, operator sdk.AccAddress, oldKey *tmprotocrypto.PublicKey, - newKey *tmprotocrypto.PublicKey, chainID string, +// AfterOperatorKeyReplaced is the implementation of the operator hooks. +// CONTRACT: key replacement is not allowed if the operator is in the process of removing their +// key. +// CONTRACT: key replacement from newKey to oldKey is not allowed, after a replacement from +// oldKey to newKey. +func (h OperatorHooksWrapper) AfterOperatorKeyReplaced( + ctx sdk.Context, _ sdk.AccAddress, oldKey *tmprotocrypto.PublicKey, + _ *tmprotocrypto.PublicKey, chainID string, ) { - if strings.Compare(chainID, ctx.ChainID()) == 0 { - // a key replacement means that the old key needs to be pruned upon maturity. - h.keeper.SetUnbondingInformation(ctx, operator, oldKey, false) - h.keeper.ClearUnbondingInformation(ctx, operator, newKey) + // the impact of key replacement is: + // 1. vote power of old key is 0, which happens automatically at epoch end in EndBlock. this + // is because the key is in the previous set but not in the new one and our code will queue + // a validator update of 0 fot this. + // 2. vote power of new key is calculated, which happens automatically at epoch end in + // EndBlock. + // 3. X epochs later, the reverse lookup of old cons addr + chain id -> operator addr + // should be cleared. + if chainID == ctx.ChainID() { + unbondingEpoch := h.keeper.GetUnbondingCompletionEpoch(ctx) + // #nosec G703 // type is known so this will not fail + consAddr, _ := operatortypes.TMCryptoPublicKeyToConsAddr(oldKey) + // nb: if operator sets key, it is not "at stake" till the end of the epoch. + // before that time, any key replacement will store a superfluous entry for pruning + // since the old key will not be in use. + // this technically gives an operator the opportunity to spam the pruning queue + // but it is not a security risk or a DOS vector given the cost charged. + h.keeper.AppendConsensusAddrToPrune(ctx, unbondingEpoch, consAddr) } } -// AfterOperatorOptOutInitiated is the implementation of the operator hooks. -func (h OperatorHooksWrapper) AfterOperatorOptOutInitiated( - ctx sdk.Context, operator sdk.AccAddress, chainID string, key *tmprotocrypto.PublicKey, +// AfterOperatorKeyRemovalInitiated is the implementation of the operator hooks. +func (h OperatorHooksWrapper) AfterOperatorKeyRemovalInitiated( + ctx sdk.Context, operator sdk.AccAddress, chainID string, _ *tmprotocrypto.PublicKey, ) { - if strings.Compare(chainID, ctx.ChainID()) == 0 { - h.keeper.SetUnbondingInformation(ctx, operator, key, true) + // the impact of key removal is: + // 1. vote power of the operator is 0, which happens automatically at epoch end in EndBlock. + // this is because GetActiveOperatorsForChainID filters operators who are removing their + // keys from the chain. + // 2. X epochs later, the removal is marked complete in the operator module. + if chainID == ctx.ChainID() { + h.keeper.SetOptOutInformation(ctx, operator) } } diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go index 0496da2b5..b4aedf176 100644 --- a/x/dogfood/keeper/impl_sdk.go +++ b/x/dogfood/keeper/impl_sdk.go @@ -4,10 +4,7 @@ import ( "sort" "cosmossdk.io/math" - operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" abci "github.com/cometbft/cometbft/abci/types" - tmtypes "github.com/cometbft/cometbft/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" @@ -41,19 +38,20 @@ func (k Keeper) GetParams(sdk.Context) stakingtypes.Params { func (k Keeper) IterateValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool), ) { - // no op + // not intentionally implemented, since unused by the importing modules } // Validator is an implementation of the staking interface expected by the SDK's -// slashing module. The slashing module uses it to obtain a validator's information at -// its addition to the list of validators, and then to unjail a validator. The former -// is used to create the pub key to cons address mapping, which we do in the operator module. -// The latter should also be implemented in the operator module, or maybe the slashing module -// depending upon the finalized design. We don't need to implement this function here because -// we are not calling the AfterValidatorCreated hook in our module, so this will never be -// reached. -func (k Keeper) Validator(sdk.Context, sdk.ValAddress) stakingtypes.ValidatorI { - panic("unimplemented on this keeper") +// slashing module. The slashing module uses it to obtain a validator's information upon +// its addition to the list of validators, and then to unjail a validator. During the addition +// it stores a reverse lookup from consensus address to pub key, which is why we need the +// pub key to be set in this call. +func (k Keeper) Validator(ctx sdk.Context, address sdk.ValAddress) stakingtypes.ValidatorI { + val, found := k.GetValidator(ctx, address) + if !found { + return nil + } + return val } // ValidatorByConsAddr is an implementation of the staking interface expected by the SDK's @@ -68,7 +66,17 @@ func (k Keeper) ValidatorByConsAddr( ctx sdk.Context, addr sdk.ConsAddress, ) stakingtypes.ValidatorI { - return k.operatorKeeper.ValidatorByConsAddrForChainID(ctx, addr, ctx.ChainID()) + // this validator has the following items initialized: + // jailed status, operator address, bonded status == unspecified, + // consensus public key. + // the operator address is used by our EVM module, and its presence triggers + // a call to Validator(ctx, addr) in the slashing module, which is implemented in this file. + // after that call, the ConsPubKey is fetched, which is also set by the below call. + val, found := k.operatorKeeper.ValidatorByConsAddrForChainID(ctx, addr, ctx.ChainID()) + if !found { + return nil + } + return val } // Slash is an implementation of the staking interface expected by the SDK's slashing module. @@ -144,6 +152,7 @@ func (k Keeper) MaxValidators(ctx sdk.Context) uint32 { // GetAllValidators is an implementation of the staking interface expected by the SDK's // slashing module. It is not called within the slashing module, but is part of the interface. +// Hence, it is not implemented meaningfully. func (k Keeper) GetAllValidators(sdk.Context) (validators []stakingtypes.Validator) { return []stakingtypes.Validator{} } @@ -167,8 +176,9 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates( // IterateBondedValidatorsByPower is an implementation of the staking interface expected by // the SDK's gov module and by our oracle module. func (k Keeper) IterateBondedValidatorsByPower( - ctx sdk.Context, f func(int64, stakingtypes.ValidatorI) bool, + ctx sdk.Context, f func(int64, stakingtypes.ValidatorI) (stop bool), ) { + // this is the bonded validators, that is, those that are currently in this module. prevList := k.GetAllExocoreValidators(ctx) sort.SliceStable(prevList, func(i, j int) bool { return prevList[i].Power > prevList[j].Power @@ -176,22 +186,24 @@ func (k Keeper) IterateBondedValidatorsByPower( for i, v := range prevList { pk, err := v.ConsPubKey() if err != nil { - // will only happen if there is an error in deserialization. + ctx.Logger().Error("Failed to deserialize public key; skipping", "error", err, "i", i) continue } - val, err := stakingtypes.NewValidator( - // TODO: this is not the correct address, which is derived from - // sdk.ValAddress(sdk.AccAddress) - sdk.ValAddress(pk.Address()), - pk, stakingtypes.Description{}, + val, found := k.operatorKeeper.ValidatorByConsAddrForChainID( + ctx, sdk.GetConsAddress(pk), ctx.ChainID(), ) - if err != nil { - // will only happen if there is an error in deserialization. + if !found { + ctx.Logger().Error("Operator address not found; skipping", "consAddress", sdk.GetConsAddress(pk), "i", i) continue } - // allow calculation of power - val.Status = stakingtypes.Bonded + // the voting power is fetched from this module and not the operator module + // because it is applied at the end of an epoch, whereas that from the operator + // module is more recent. val.Tokens = sdk.TokensFromConsensusPower(v.Power, sdk.DefaultPowerReduction) + // since the validator object was fetched from this module, we should set it to bonded. + val.Status = stakingtypes.Bonded + // items passed are: + // jailed status, tokens quantity, operator address as ValAddress, bonded status if f(int64(i), val) { break } @@ -213,39 +225,3 @@ func (k Keeper) IterateDelegations( ) { panic("unimplemented on this keeper") } - -func (k Keeper) WriteValidators(ctx sdk.Context) ([]tmtypes.GenesisValidator, error) { - validators := k.GetAllExocoreValidators(ctx) - sort.SliceStable(validators, func(i, j int) bool { - return validators[i].Power > validators[j].Power - }) - vals := make([]tmtypes.GenesisValidator, len(validators)) - var retErr error - for i, val := range validators { - pk, err := val.ConsPubKey() - if err != nil { - retErr = err - break - } - tmPk, err := cryptocodec.ToTmPubKeyInterface(pk) - if err != nil { - retErr = err - break - } - consAddress := sdk.GetConsAddress(pk) - found, addr := k.operatorKeeper.GetOperatorAddressForChainIDAndConsAddr( - ctx, ctx.ChainID(), consAddress, - ) - if !found { - retErr = operatortypes.ErrNoKeyInTheStore - break - } - vals[i] = tmtypes.GenesisValidator{ - Address: consAddress.Bytes(), - PubKey: tmPk, - Power: val.Power, - Name: addr.String(), // TODO - } - } - return vals, retErr -} diff --git a/x/dogfood/keeper/opt_out.go b/x/dogfood/keeper/opt_out.go index 837fc925f..0c6299bca 100644 --- a/x/dogfood/keeper/opt_out.go +++ b/x/dogfood/keeper/opt_out.go @@ -5,6 +5,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +// SetOptOutInformation sets information related to an operator's opt out. +func (k Keeper) SetOptOutInformation( + ctx sdk.Context, addr sdk.AccAddress, +) { + unbondingCompletionEpoch := k.GetUnbondingCompletionEpoch(ctx) + k.AppendOptOutToFinish(ctx, unbondingCompletionEpoch, addr) + k.SetOperatorOptOutFinishEpoch(ctx, addr, unbondingCompletionEpoch) + // CompleteOperatorKeyRemovalForChainID calls DeleteOperatorAddressForChainIDAndConsAddr, + // so we do not need to save ConsensusAddrToPrune in the unbonding case. +} + // AppendOptOutToFinish appends an operator address to the list of operator addresses that have // opted out and will be finished at the end of the provided epoch. func (k Keeper) AppendOptOutToFinish( @@ -48,16 +59,6 @@ func (k Keeper) setOptOutsToFinish( store.Set(key, bz) } -// RemoveOptOutToFinish removes an operator address from the list of operator addresses that -// have opted out and will be finished at the end of the provided epoch. -func (k Keeper) RemoveOptOutToFinish(ctx sdk.Context, epoch int64, addr sdk.AccAddress) { - prev := k.GetOptOutsToFinish(ctx, epoch) - next := types.AccountAddresses{ - List: types.RemoveFromBytesList(prev, addr), - } - k.setOptOutsToFinish(ctx, epoch, next) -} - // ClearOptOutsToFinish clears the list of operator addresses that have opted out and will be // finished at the end of the provided epoch. func (k Keeper) ClearOptOutsToFinish(ctx sdk.Context, epoch int64) { @@ -66,6 +67,33 @@ func (k Keeper) ClearOptOutsToFinish(ctx sdk.Context, epoch int64) { store.Delete(key) } +// GetAllOptOutsToFinish gets a list of epochs and the corresponding operator addresses +// whose opt outs are scheduled to finish at the end of those epochs. It is ordered, +// first by the epoch and then by the operator address bytes. +func (k Keeper) GetAllOptOutsToFinish(ctx sdk.Context) []types.EpochToOperatorAddrs { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{types.OptOutsToFinishBytePrefix}) + defer iterator.Close() + + res := []types.EpochToOperatorAddrs{} + + for ; iterator.Valid(); iterator.Next() { + epoch, _ := types.SafeUint64ToInt64(sdk.BigEndianToUint64(iterator.Key()[1:])) + var addrs types.AccountAddresses + k.cdc.MustUnmarshal(iterator.Value(), &addrs) + subRes := []string{} + for _, addr := range addrs.GetList() { + subRes = append(subRes, sdk.AccAddress(addr).String()) + } + res = append(res, types.EpochToOperatorAddrs{ + Epoch: epoch, + OperatorAccAddrs: subRes, + }) + } + + return res +} + // SetOperatorOptOutFinishEpoch sets the epoch at which an operator's opt out will be finished. func (k Keeper) SetOperatorOptOutFinishEpoch( ctx sdk.Context, operatorAddr sdk.AccAddress, epoch int64, @@ -131,18 +159,6 @@ func (k Keeper) GetConsensusAddrsToPrune( return res.GetList() } -// DeleteConsensusAddrToPrune deletes a consensus address from the list of consensus addresses -// to prune at the end of the provided epoch. -func (k Keeper) DeleteConsensusAddrToPrune( - ctx sdk.Context, epoch int64, addr sdk.ConsAddress, -) { - prev := k.GetConsensusAddrsToPrune(ctx, epoch) - next := types.ConsensusAddresses{ - List: types.RemoveFromBytesList(prev, addr.Bytes()), - } - k.setConsensusAddrsToPrune(ctx, epoch, next) -} - // ClearConsensusAddrsToPrune clears the list of consensus addresses to prune at the end of the // epoch. func (k Keeper) ClearConsensusAddrsToPrune(ctx sdk.Context, epoch int64) { @@ -164,3 +180,30 @@ func (k Keeper) setConsensusAddrsToPrune( } store.Set(key, bz) } + +// GetAllConsAddrsToPrune gets a list of epochs and the corresponding consensus addresses +// which should be pruned from the operator module at the end of that epoch. It is ordered, +// first by the epoch and then by the consensus address bytes. +func (k Keeper) GetAllConsAddrsToPrune(ctx sdk.Context) []types.EpochToConsensusAddrs { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{types.OptOutsToFinishBytePrefix}) + defer iterator.Close() + + res := []types.EpochToConsensusAddrs{} + + for ; iterator.Valid(); iterator.Next() { + epoch, _ := types.SafeUint64ToInt64(sdk.BigEndianToUint64(iterator.Key()[1:])) + var addrs types.ConsensusAddresses + k.cdc.MustUnmarshal(iterator.Value(), &addrs) + subRes := []string{} + for _, addr := range addrs.GetList() { + subRes = append(subRes, sdk.ConsAddress(addr).String()) + } + res = append(res, types.EpochToConsensusAddrs{ + Epoch: epoch, + ConsAddrs: subRes, + }) + } + + return res +} diff --git a/x/dogfood/keeper/query.go b/x/dogfood/keeper/query.go index 60c010b19..0208d7632 100644 --- a/x/dogfood/keeper/query.go +++ b/x/dogfood/keeper/query.go @@ -23,3 +23,82 @@ func (k Keeper) Params( return &types.QueryParamsResponse{Params: k.GetDogfoodParams(ctx)}, nil } + +func (k Keeper) OptOutsToFinish( + goCtx context.Context, + req *types.QueryOptOutsToFinishRequest, +) (*types.AccountAddresses, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + epoch := req.Epoch + addresses := k.GetOptOutsToFinish(ctx, epoch) + // TODO: consider converting this to a slice of strings? + return &types.AccountAddresses{List: addresses}, nil +} + +func (k Keeper) OperatorOptOutFinishEpoch( + goCtx context.Context, + req *types.QueryOperatorOptOutFinishEpochRequest, +) (*types.QueryOperatorOptOutFinishEpochResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + accAddr, err := sdk.AccAddressFromBech32(req.OperatorAccAddr) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid operator address") + } + epoch := k.GetOperatorOptOutFinishEpoch(ctx, accAddr) + return &types.QueryOperatorOptOutFinishEpochResponse{Epoch: epoch}, nil +} + +func (k Keeper) UndelegationsToMature( + goCtx context.Context, + req *types.QueryUndelegationsToMatureRequest, +) (*types.UndelegationRecordKeys, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + epoch := req.Epoch + keys := k.GetUndelegationsToMature(ctx, epoch) + return &types.UndelegationRecordKeys{List: keys}, nil +} + +func (k Keeper) UndelegationMaturityEpoch( + goCtx context.Context, + req *types.QueryUndelegationMaturityEpochRequest, +) (*types.QueryUndelegationMaturityEpochResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + epoch, found := k.GetUndelegationMaturityEpoch(ctx, []byte(req.RecordKey)) + if !found { + return nil, status.Error(codes.NotFound, "undelegation record not found") + } + return &types.QueryUndelegationMaturityEpochResponse{Epoch: epoch}, nil +} + +func (k Keeper) QueryValidator( + goCtx context.Context, + req *types.QueryValidatorRequest, +) (*types.ExocoreValidator, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + consAddress := req.ConsAddr + consAddressBytes, err := sdk.ConsAddressFromBech32(consAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid consensus address") + } + validator, found := k.GetExocoreValidator(ctx, consAddressBytes) + if !found { + return nil, status.Error(codes.NotFound, "validator not found") + } + return &validator, nil +} diff --git a/x/dogfood/keeper/unbonding.go b/x/dogfood/keeper/unbonding.go index a4c7c60a7..3bc21dd22 100644 --- a/x/dogfood/keeper/unbonding.go +++ b/x/dogfood/keeper/unbonding.go @@ -2,43 +2,10 @@ package keeper import ( "github.com/ExocoreNetwork/exocore/x/dogfood/types" - operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" - tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common/hexutil" ) -// ClearUnbondingInformation clears all information related to an operator's opt out -// or key replacement. This is done because the operator has opted back in or has -// replaced their key (again) with the original one. -func (k Keeper) ClearUnbondingInformation( - ctx sdk.Context, addr sdk.AccAddress, pubKey *tmprotocrypto.PublicKey, -) { - optOutEpoch := k.GetOperatorOptOutFinishEpoch(ctx, addr) - k.DeleteOperatorOptOutFinishEpoch(ctx, addr) - k.RemoveOptOutToFinish(ctx, optOutEpoch, addr) - consAddress, err := operatortypes.TMCryptoPublicKeyToConsAddr(pubKey) - if err != nil { - return - } - k.DeleteConsensusAddrToPrune(ctx, optOutEpoch, consAddress) -} - -// SetUnbondingInformation sets information related to an operator's opt out or key replacement. -func (k Keeper) SetUnbondingInformation( - ctx sdk.Context, addr sdk.AccAddress, pubKey *tmprotocrypto.PublicKey, isOptingOut bool, -) { - unbondingCompletionEpoch := k.GetUnbondingCompletionEpoch(ctx) - if isOptingOut { - k.AppendOptOutToFinish(ctx, unbondingCompletionEpoch, addr) - k.SetOperatorOptOutFinishEpoch(ctx, addr, unbondingCompletionEpoch) - } - consAddress, err := operatortypes.TMCryptoPublicKeyToConsAddr(pubKey) - if err != nil { - return - } - k.AppendConsensusAddrToPrune(ctx, unbondingCompletionEpoch, consAddress) -} - // GetUnbondingCompletionEpoch returns the epoch at the end of which // an unbonding triggered in this epoch will be completed. func (k Keeper) GetUnbondingCompletionEpoch( @@ -109,3 +76,64 @@ func (k Keeper) setUndelegationsToMature( } store.Set(key, val) } + +// GetAllUndelegationsToMature gets a list of epochs and the corresponding undelegation record +// keys which are scheduled to mature at the end of that epoch. It is ordered, first by the +// epoch and then by the record key's bytes. +func (k Keeper) GetAllUndelegationsToMature(ctx sdk.Context) []types.EpochToUndelegationRecordKeys { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{types.OptOutsToFinishBytePrefix}) + defer iterator.Close() + + res := []types.EpochToUndelegationRecordKeys{} + + for ; iterator.Valid(); iterator.Next() { + epoch, _ := types.SafeUint64ToInt64(sdk.BigEndianToUint64(iterator.Key()[1:])) + var recordKeys types.UndelegationRecordKeys + k.cdc.MustUnmarshal(iterator.Value(), &recordKeys) + subRes := []string{} + for _, recordKey := range recordKeys.GetList() { + subRes = append(subRes, hexutil.Encode(recordKey)) + } + res = append(res, types.EpochToUndelegationRecordKeys{ + Epoch: epoch, + UndelegationRecordKeys: subRes, + }) + } + + return res +} + +// GetUndelegationMaturityEpoch gets the maturity epoch for the undelegation record. +func (k Keeper) GetUndelegationMaturityEpoch( + ctx sdk.Context, recordKey []byte, +) (int64, bool) { + store := ctx.KVStore(k.storeKey) + key := types.UndelegationMaturityEpochKey(recordKey) + bz := store.Get(key) + if bz == nil { + return 0, false + } + epoch := sdk.BigEndianToUint64(bz) + return types.SafeUint64ToInt64(epoch) +} + +// SetUndelegationMaturityEpoch sets the maturity epoch for the undelegation record. +func (k Keeper) SetUndelegationMaturityEpoch( + ctx sdk.Context, recordKey []byte, epoch int64, +) { + store := ctx.KVStore(k.storeKey) + key := types.UndelegationMaturityEpochKey(recordKey) + uepoch, _ := types.SafeInt64ToUint64(epoch) + bz := sdk.Uint64ToBigEndian(uepoch) + store.Set(key, bz) +} + +// ClearUndelegationMaturityEpoch clears the maturity epoch for the undelegation record. +func (k Keeper) ClearUndelegationMaturityEpoch( + ctx sdk.Context, recordKey []byte, +) { + store := ctx.KVStore(k.storeKey) + key := types.UndelegationMaturityEpochKey(recordKey) + store.Delete(key) +} diff --git a/x/dogfood/keeper/validators.go b/x/dogfood/keeper/validators.go index b6aaf2d71..04e853314 100644 --- a/x/dogfood/keeper/validators.go +++ b/x/dogfood/keeper/validators.go @@ -1,6 +1,6 @@ // This file is a duplicate of the subscriber module's validators file with minor changes. // The function ApplyValidatorChanges can likely be carved out into a shared package with -// the appchain module. +// the appchain module when it is ready. package keeper @@ -10,6 +10,7 @@ import ( "cosmossdk.io/math" "github.com/ExocoreNetwork/exocore/x/dogfood/types" + operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" abci "github.com/cometbft/cometbft/abci/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -39,6 +40,7 @@ func (k Keeper) ApplyValidatorChanges( ctx sdk.Context, changes []abci.ValidatorUpdate, ) []abci.ValidatorUpdate { ret := []abci.ValidatorUpdate{} + logger := k.Logger(ctx) for _, change := range changes { // convert TM pubkey to SDK pubkey for storage within the validator object. pubkey, err := cryptocodec.FromTmProtoPublicKey(change.GetPubKey()) @@ -48,34 +50,67 @@ func (k Keeper) ApplyValidatorChanges( // other parts of the module. // In no situation it should happen; however, if it does, // we do not panic. Simply skip the change. + logger.Error("could not convert tendermint pubkey to sdk pubkey", "error", err) continue } // the address is just derived from the public key and // has no correlation with the operator address on Exocore. addr := pubkey.Address() - val, found := k.GetValidator(ctx, addr) + val, found := k.GetExocoreValidator(ctx, addr) switch found { case true: // update or delete an existing validator. // assumption: power can not be negative. if change.Power < 1 { - k.DeleteValidator(ctx, addr) + // guard for errors within the hooks. + cc, writeFunc := ctx.CacheContext() + k.DeleteExocoreValidator(cc, addr) + // sdk slashing.AfterValidatorRemoved deletes the lookup from cons address to + // cons pub key + err = k.Hooks().AfterValidatorRemoved(cc, sdk.ConsAddress(addr), nil) + if err != nil { + logger.Error("error in AfterValidatorRemoved", "error", err) + continue + } + writeFunc() } else { val.Power = change.Power - k.SetValidator(ctx, val) + // guard for errors within the hooks. + cc, writeFunc := ctx.CacheContext() + k.SetExocoreValidator(ctx, val) + // sdk slashing.AfterValidatorCreated stores the lookup from cons address to + // cons pub key. it loads the validator from `valAddr` (operator address) + // via stakingkeeeper.Validator(ctx, valAddr) + // then it fetches the cons pub key from said validator to generate the lookup + found, accAddress := k.operatorKeeper.GetOperatorAddressForChainIDAndConsAddr( + ctx, ctx.ChainID(), sdk.ConsAddress(addr), + ) + if !found { + // should never happen + logger.Error("operator address not found for validator", "cons address", addr) + continue + } + err = k.Hooks().AfterValidatorCreated(cc, sdk.ValAddress(accAddress)) + if err != nil { + logger.Error("error in AfterValidatorCreated", "error", err) + continue + } + writeFunc() } case false: if change.Power > 0 { // create a new validator. ocVal, err := types.NewExocoreValidator(addr, change.Power, pubkey) if err != nil { + logger.Error("could not create new exocore validator", "error", err) continue } - // guard for errors within the AfterValidatorBonded hook. + // guard for errors within the hooks. cc, writeFunc := ctx.CacheContext() - k.SetValidator(cc, ocVal) + k.SetExocoreValidator(cc, ocVal) err = k.Hooks().AfterValidatorBonded(cc, sdk.ConsAddress(addr), nil) if err != nil { + logger.Error("error in AfterValidatorBonded", "error", err) // If an error is returned, the validator is not added to the `ret` slice. continue } @@ -84,6 +119,7 @@ func (k Keeper) ApplyValidatorChanges( // edge case: we received an update for 0 power // but the validator is already deleted. Do not forward // to tendermint. + logger.Info("received update for non-existent validator", "cons address", addr) continue } } @@ -104,17 +140,17 @@ func (k Keeper) ApplyValidatorChanges( return ret } -// SetValidator stores a validator based on the pub key derived address. This +// SetExocoreValidator stores a validator based on the pub key derived address. This // is accessible in the genesis state via `val_set`. -func (k Keeper) SetValidator(ctx sdk.Context, validator types.ExocoreValidator) { +func (k Keeper) SetExocoreValidator(ctx sdk.Context, validator types.ExocoreValidator) { store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&validator) store.Set(types.ExocoreValidatorKey(validator.Address), bz) } -// GetValidator gets a validator based on the pub key derived (consensus) address. -func (k Keeper) GetValidator( +// GetExocoreValidator gets a validator based on the pub key derived (consensus) address. +func (k Keeper) GetExocoreValidator( ctx sdk.Context, addr []byte, ) (validator types.ExocoreValidator, found bool) { store := ctx.KVStore(k.storeKey) @@ -128,8 +164,8 @@ func (k Keeper) GetValidator( return } -// DeleteValidator deletes a validator based on the pub key derived address. -func (k Keeper) DeleteValidator(ctx sdk.Context, addr []byte) { +// DeleteExocoreValidator deletes a validator based on the pub key derived address. +func (k Keeper) DeleteExocoreValidator(ctx sdk.Context, addr []byte) { store := ctx.KVStore(k.storeKey) store.Delete(types.ExocoreValidatorKey(addr)) } @@ -306,3 +342,31 @@ func (k Keeper) GetValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate { return valUpdates.Updates } + +// GetValidator fetchs a stakingtypes.Validator given the validator's address. +// This is just the account address, but sent as sdk.ValAddress(accAddr). +func (k Keeper) GetValidator( + ctx sdk.Context, valAddr sdk.ValAddress, +) (stakingtypes.Validator, bool) { + accAddr := sdk.AccAddress(valAddr) + found, consPubKey, err := k.operatorKeeper.GetOperatorConsKeyForChainID( + ctx, accAddr, ctx.ChainID(), + ) + if !found || err != nil { + return stakingtypes.Validator{}, false + } + consAddr, err := operatortypes.TMCryptoPublicKeyToConsAddr(consPubKey) + if err != nil { + return stakingtypes.Validator{}, false + } + val, found := k.operatorKeeper.ValidatorByConsAddrForChainID( + ctx, consAddr, ctx.ChainID(), + ) + if !found { + return stakingtypes.Validator{}, false + } + // the bonded status of the validator is unspecified, since we don't know if it is + // actually in this module or not. we are not checking it either, since there is no + // particular reason to do so. + return val, true +} diff --git a/x/dogfood/types/dogfood.pb.go b/x/dogfood/types/dogfood.pb.go index 53b91a0fb..99da5a42a 100644 --- a/x/dogfood/types/dogfood.pb.go +++ b/x/dogfood/types/dogfood.pb.go @@ -140,53 +140,6 @@ func (m *AccountAddresses) GetList() [][]byte { return nil } -// ConsensusAddresses represents a list of account addresses. It is used to store the list of -// addresses (which correspond to operator public keys) to delete at the end of an epoch. -type ConsensusAddresses struct { - // list is the list of consensus addresses. - List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` -} - -func (m *ConsensusAddresses) Reset() { *m = ConsensusAddresses{} } -func (m *ConsensusAddresses) String() string { return proto.CompactTextString(m) } -func (*ConsensusAddresses) ProtoMessage() {} -func (*ConsensusAddresses) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{2} -} -func (m *ConsensusAddresses) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConsensusAddresses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConsensusAddresses.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ConsensusAddresses) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsensusAddresses.Merge(m, src) -} -func (m *ConsensusAddresses) XXX_Size() int { - return m.Size() -} -func (m *ConsensusAddresses) XXX_DiscardUnknown() { - xxx_messageInfo_ConsensusAddresses.DiscardUnknown(m) -} - -var xxx_messageInfo_ConsensusAddresses proto.InternalMessageInfo - -func (m *ConsensusAddresses) GetList() [][]byte { - if m != nil { - return m.List - } - return nil -} - // UndelegationRecordKeys is a collection of undelegation record keys. This is used to store a // list of undelegation records to mature in the delegation module at the end of the epoch. type UndelegationRecordKeys struct { @@ -198,7 +151,7 @@ func (m *UndelegationRecordKeys) Reset() { *m = UndelegationRecordKeys{} func (m *UndelegationRecordKeys) String() string { return proto.CompactTextString(m) } func (*UndelegationRecordKeys) ProtoMessage() {} func (*UndelegationRecordKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{3} + return fileDescriptor_071b9989c501c3f2, []int{2} } func (m *UndelegationRecordKeys) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -244,7 +197,7 @@ func (m *Validators) Reset() { *m = Validators{} } func (m *Validators) String() string { return proto.CompactTextString(m) } func (*Validators) ProtoMessage() {} func (*Validators) Descriptor() ([]byte, []int) { - return fileDescriptor_071b9989c501c3f2, []int{4} + return fileDescriptor_071b9989c501c3f2, []int{3} } func (m *Validators) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -280,44 +233,90 @@ func (m *Validators) GetList() []types1.Validator { return nil } +// ConsensusAddresses is a list of consensus addresses. +type ConsensusAddresses struct { + // list is the list of consensus addresses. + List [][]byte `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` +} + +func (m *ConsensusAddresses) Reset() { *m = ConsensusAddresses{} } +func (m *ConsensusAddresses) String() string { return proto.CompactTextString(m) } +func (*ConsensusAddresses) ProtoMessage() {} +func (*ConsensusAddresses) Descriptor() ([]byte, []int) { + return fileDescriptor_071b9989c501c3f2, []int{4} +} +func (m *ConsensusAddresses) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsensusAddresses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsensusAddresses.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsensusAddresses) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusAddresses.Merge(m, src) +} +func (m *ConsensusAddresses) XXX_Size() int { + return m.Size() +} +func (m *ConsensusAddresses) XXX_DiscardUnknown() { + xxx_messageInfo_ConsensusAddresses.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsensusAddresses proto.InternalMessageInfo + +func (m *ConsensusAddresses) GetList() [][]byte { + if m != nil { + return m.List + } + return nil +} + func init() { proto.RegisterType((*ExocoreValidator)(nil), "exocore.dogfood.v1.ExocoreValidator") proto.RegisterType((*AccountAddresses)(nil), "exocore.dogfood.v1.AccountAddresses") - proto.RegisterType((*ConsensusAddresses)(nil), "exocore.dogfood.v1.ConsensusAddresses") proto.RegisterType((*UndelegationRecordKeys)(nil), "exocore.dogfood.v1.UndelegationRecordKeys") proto.RegisterType((*Validators)(nil), "exocore.dogfood.v1.Validators") + proto.RegisterType((*ConsensusAddresses)(nil), "exocore.dogfood.v1.ConsensusAddresses") } func init() { proto.RegisterFile("exocore/dogfood/v1/dogfood.proto", fileDescriptor_071b9989c501c3f2) } var fileDescriptor_071b9989c501c3f2 = []byte{ - // 412 bytes of a gzipped FileDescriptorProto + // 413 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xc1, 0x6e, 0xd3, 0x40, 0x10, 0x86, 0xb3, 0xa4, 0x14, 0x69, 0xdb, 0x43, 0xb5, 0x8a, 0xc0, 0xf4, 0xe0, 0x1a, 0x0b, 0x21, 0x1f, 0x60, 0x57, 0x6e, 0x6f, 0x70, 0x4a, 0x10, 0x07, 0x14, 0x09, 0x21, 0x4b, 0x70, 0xe0, 0x52, - 0xad, 0xed, 0xa9, 0xb1, 0xe2, 0x78, 0xac, 0xdd, 0x75, 0xda, 0x7d, 0x0b, 0x5e, 0x82, 0x37, 0xe0, - 0x21, 0x2a, 0x4e, 0x3d, 0x72, 0x8a, 0x50, 0xf2, 0x06, 0x3c, 0x01, 0x22, 0xeb, 0x8d, 0x38, 0x20, - 0x6e, 0xf3, 0xef, 0xfc, 0xfb, 0xeb, 0xd3, 0xcc, 0xd0, 0x08, 0x6e, 0xb0, 0x40, 0x05, 0x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 0x0f, 0x9a, 0x5a, 0xe9, 0x80, 0x44, 0xe3, 0xe4, 0x38, 0xdb, + 0xd5, 0xf1, 0x73, 0xfa, 0xf0, 0x43, 0x5b, 0x42, 0x03, 0x95, 0xd4, 0x35, 0xb6, 0x19, 0x14, 0xd8, + 0x97, 0x73, 0x30, 0xff, 0x76, 0xbf, 0xa5, 0x74, 0x3f, 0xb5, 0x62, 0xaf, 0xfe, 0x72, 0x1c, 0x9d, + 0x3f, 0xe1, 0x0e, 0xc8, 0xef, 0xd2, 0xed, 0x96, 0xef, 0x5f, 0xcc, 0x0e, 0x6e, 0xd7, 0x67, 0x23, + 0x17, 0x95, 0x50, 0xf6, 0xda, 0x4f, 0xf5, 0x5f, 0xc4, 0xd9, 0xfc, 0x76, 0x13, 0x92, 0xbb, 0x4d, + 0x48, 0x7e, 0x6e, 0x42, 0xf2, 0x65, 0x1b, 0x8e, 0xee, 0xb6, 0xe1, 0xe8, 0xc7, 0x36, 0x1c, 0x7d, + 0x4a, 0xab, 0x5a, 0x7f, 0x1e, 0x72, 0x5e, 0xe0, 0x52, 0xb8, 0x9f, 0xf2, 0x0e, 0xf4, 0x35, 0xf6, + 0x0b, 0xe1, 0xcf, 0xe9, 0x66, 0x7f, 0x50, 0xda, 0x74, 0xa0, 0xf2, 0xc3, 0xdd, 0x8a, 0x2f, 0x7e, + 0x07, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xfc, 0xef, 0x8c, 0x70, 0x02, 0x00, 0x00, } func (m *ExocoreValidator) Marshal() (dAtA []byte, err error) { @@ -399,7 +398,7 @@ func (m *AccountAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ConsensusAddresses) Marshal() (dAtA []byte, err error) { +func (m *UndelegationRecordKeys) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -409,12 +408,12 @@ func (m *ConsensusAddresses) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ConsensusAddresses) MarshalTo(dAtA []byte) (int, error) { +func (m *UndelegationRecordKeys) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ConsensusAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *UndelegationRecordKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -431,7 +430,7 @@ func (m *ConsensusAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *UndelegationRecordKeys) Marshal() (dAtA []byte, err error) { +func (m *Validators) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -441,21 +440,26 @@ func (m *UndelegationRecordKeys) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *UndelegationRecordKeys) MarshalTo(dAtA []byte) (int, error) { +func (m *Validators) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *UndelegationRecordKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Validators) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.List) > 0 { for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.List[iNdEx]) - copy(dAtA[i:], m.List[iNdEx]) - i = encodeVarintDogfood(dAtA, i, uint64(len(m.List[iNdEx]))) + { + size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDogfood(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -463,7 +467,7 @@ func (m *UndelegationRecordKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *Validators) Marshal() (dAtA []byte, err error) { +func (m *ConsensusAddresses) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -473,26 +477,21 @@ func (m *Validators) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Validators) MarshalTo(dAtA []byte) (int, error) { +func (m *ConsensusAddresses) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Validators) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ConsensusAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.List) > 0 { for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintDogfood(dAtA, i, uint64(size)) - } + i -= len(m.List[iNdEx]) + copy(dAtA[i:], m.List[iNdEx]) + i = encodeVarintDogfood(dAtA, i, uint64(len(m.List[iNdEx]))) i-- dAtA[i] = 0xa } @@ -546,7 +545,7 @@ func (m *AccountAddresses) Size() (n int) { return n } -func (m *ConsensusAddresses) Size() (n int) { +func (m *UndelegationRecordKeys) Size() (n int) { if m == nil { return 0 } @@ -561,30 +560,30 @@ func (m *ConsensusAddresses) Size() (n int) { return n } -func (m *UndelegationRecordKeys) Size() (n int) { +func (m *Validators) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.List) > 0 { - for _, b := range m.List { - l = len(b) + for _, e := range m.List { + l = e.Size() n += 1 + l + sovDogfood(uint64(l)) } } return n } -func (m *Validators) Size() (n int) { +func (m *ConsensusAddresses) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.List) > 0 { - for _, e := range m.List { - l = e.Size() + for _, b := range m.List { + l = len(b) n += 1 + l + sovDogfood(uint64(l)) } } @@ -818,7 +817,7 @@ func (m *AccountAddresses) Unmarshal(dAtA []byte) error { } return nil } -func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { +func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -841,10 +840,10 @@ func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConsensusAddresses: wiretype end group for non-group") + return fmt.Errorf("proto: UndelegationRecordKeys: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConsensusAddresses: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UndelegationRecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -900,7 +899,7 @@ func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { } return nil } -func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { +func (m *Validators) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -923,17 +922,17 @@ func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UndelegationRecordKeys: wiretype end group for non-group") + return fmt.Errorf("proto: Validators: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UndelegationRecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Validators: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDogfood @@ -943,23 +942,25 @@ func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthDogfood } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthDogfood } if postIndex > l { return io.ErrUnexpectedEOF } - m.List = append(m.List, make([]byte, postIndex-iNdEx)) - copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) + m.List = append(m.List, types1.Validator{}) + if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -982,7 +983,7 @@ func (m *UndelegationRecordKeys) Unmarshal(dAtA []byte) error { } return nil } -func (m *Validators) Unmarshal(dAtA []byte) error { +func (m *ConsensusAddresses) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1005,17 +1006,17 @@ func (m *Validators) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Validators: wiretype end group for non-group") + return fmt.Errorf("proto: ConsensusAddresses: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Validators: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsensusAddresses: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDogfood @@ -1025,25 +1026,23 @@ func (m *Validators) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthDogfood } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthDogfood } if postIndex > l { return io.ErrUnexpectedEOF } - m.List = append(m.List, types1.Validator{}) - if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.List = append(m.List, make([]byte, postIndex-iNdEx)) + copy(m.List[len(m.List)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index 339938f22..b9f85d958 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -20,40 +20,53 @@ type DogfoodHooks interface { AfterValidatorBonded( sdk.Context, sdk.ConsAddress, sdk.ValAddress, ) error + AfterValidatorRemoved( + sdk.Context, sdk.ConsAddress, sdk.ValAddress, + ) error + AfterValidatorCreated( + sdk.Context, sdk.ValAddress, + ) error } // OperatorKeeper represents the expected keeper interface for the operator module. type OperatorKeeper interface { - GetOperatorConsKeyForChainID( - sdk.Context, sdk.AccAddress, string, - ) (bool, *tmprotocrypto.PublicKey, error) - IsOperatorOptingOutFromChainID( - sdk.Context, sdk.AccAddress, string, - ) bool - CompleteOperatorOptOutFromChainID(sdk.Context, sdk.AccAddress, string) - DeleteOperatorAddressForChainIDAndConsAddr(sdk.Context, string, sdk.ConsAddress) + // use a shorted undelegation period if the operator is opting out + IsOperatorRemovingKeyFromChainID(sdk.Context, sdk.AccAddress, string) bool + // complete the removal when done + CompleteOperatorKeyRemovalForChainID(sdk.Context, sdk.AccAddress, string) error + // reverse lookup for slashing GetOperatorAddressForChainIDAndConsAddr( sdk.Context, string, sdk.ConsAddress, ) (bool, sdk.AccAddress) + // impl_sdk IsOperatorJailedForChainID(sdk.Context, sdk.ConsAddress, string) bool Jail(sdk.Context, sdk.ConsAddress, string) Unjail(sdk.Context, sdk.ConsAddress, string) - // GetActiveOperatorsForChainID should return a list of operators and their public keys. - // These operators should not be in the process of opting out, and should not be jailed - // whether permanently or temporarily. - GetActiveOperatorsForChainID( - sdk.Context, string, - ) ([]sdk.AccAddress, []*tmprotocrypto.PublicKey) - GetAvgDelegatedValue( - sdk.Context, []sdk.AccAddress, string, string, - ) ([]int64, error) SlashWithInfractionReason( sdk.Context, sdk.AccAddress, int64, int64, sdk.Dec, stakingtypes.Infraction, ) math.Int ValidatorByConsAddrForChainID( ctx sdk.Context, consAddr sdk.ConsAddress, chainID string, - ) stakingtypes.ValidatorI + ) (stakingtypes.Validator, bool) + // at each epoch, get the list and create validator update + GetActiveOperatorsForChainID( + sdk.Context, string, + ) ([]sdk.AccAddress, []*tmprotocrypto.PublicKey) + // get vote power. TODO: replace with vote power call. + GetAvgDelegatedValue( + sdk.Context, []sdk.AccAddress, string, string, + ) ([]int64, error) + // prune slashing-related reverse lookup when matured + DeleteOperatorAddressForChainIDAndConsAddr( + ctx sdk.Context, chainID string, consAddr sdk.ConsAddress, + ) + // at each epoch, the current key becomes the "previous" key + // for further key set function calls + ClearPreviousConsensusKeys(ctx sdk.Context, chainID string) + GetOperatorConsKeyForChainID( + sdk.Context, sdk.AccAddress, string, + ) (bool, *tmprotocrypto.PublicKey, error) } // DelegationKeeper represents the expected keeper interface for the delegation module. diff --git a/x/dogfood/types/genesis.go b/x/dogfood/types/genesis.go index 792e300f2..619b6b1d5 100644 --- a/x/dogfood/types/genesis.go +++ b/x/dogfood/types/genesis.go @@ -2,22 +2,43 @@ package types import ( errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common/hexutil" ) // NewGenesis creates a new genesis state with the provided parameters and -// validators. -func NewGenesis(params Params, vals []GenesisValidator) *GenesisState { +// data. +func NewGenesis( + params Params, + vals []GenesisValidator, + expiries []EpochToOperatorAddrs, + consAddrs []EpochToConsensusAddrs, + recordKeys []EpochToUndelegationRecordKeys, + power math.Int, +) *GenesisState { return &GenesisState{ - Params: params, - InitialValSet: vals, + Params: params, + ValSet: vals, + OptOutExpiries: expiries, + ConsensusAddrsToPrune: consAddrs, + UndelegationMaturities: recordKeys, + LastTotalPower: power, } } // DefaultGenesis returns the default genesis state. func DefaultGenesis() *GenesisState { - // no initial validators intentionally, so that the caller must set them. - return NewGenesis(DefaultParams(), []GenesisValidator{}) + return NewGenesis( + DefaultParams(), + []GenesisValidator{}, + []EpochToOperatorAddrs{}, + []EpochToConsensusAddrs{}, + []EpochToUndelegationRecordKeys{}, + math.ZeroInt(), + ) } // Validate performs basic genesis state validation returning an error upon any @@ -25,16 +46,17 @@ func DefaultGenesis() *GenesisState { func (gs GenesisState) Validate() error { // #nosec G701 // ok on 64-bit systems. maxValidators := int(gs.Params.MaxValidators) - if len(gs.InitialValSet) > maxValidators { + if len(gs.ValSet) > maxValidators { return errorsmod.Wrapf( ErrInvalidGenesisData, "too many validators %d", - len(gs.InitialValSet), + len(gs.ValSet), ) } // do not complain about 0 validators, let Tendermint do that. - vals := make(map[string]struct{}, len(gs.InitialValSet)) - for _, val := range gs.InitialValSet { + vals := make(map[string]struct{}, len(gs.ValSet)) + totalPower := int64(0) + for _, val := range gs.ValSet { // check for duplicates if _, ok := vals[val.PublicKey]; ok { return errorsmod.Wrapf( @@ -63,6 +85,170 @@ func (gs GenesisState) Validate() error { power, ) } + totalPower += power + } + + // we don't know the current epoch, since this is stateless validation. + // to check epoochs aren't duplicated. + epochs := make(map[int64]struct{}, len(gs.OptOutExpiries)) + // to check that there is no duplicate address - not by per epoch but overall. + addrsMap := make(map[string]struct{}) + for _, obj := range gs.OptOutExpiries { + epoch := obj.Epoch + if _, ok := epochs[epoch]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate epoch %d", epoch, + ) + } + // the first epoch in the epochs module is 1. this epoch is first + // incremented, and then AfterEpochEnd is called with a value of 2. + // therefore, the first epoch in the dogfood module is 2. all expiries + // must happen at the end of this epoch or any epoch thereafter. + // TODO: we should fix this bug in our fork of the epochs module. + if epoch <= 1 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "epoch %d should be > 1", epoch, + ) + } + epochs[epoch] = struct{}{} + addrs := obj.OperatorAccAddrs + if len(addrs) == 0 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "empty operator addresses for epoch %d", epoch, + ) + } + for _, addr := range addrs { + if _, err := sdk.AccAddressFromBech32(addr); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid operator address %s: %s", + addr, err, + ) + } + if _, ok := addrsMap[addr]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate operator address %s", addr, + ) + } + addrsMap[addr] = struct{}{} + } + } + + epochs = make(map[int64]struct{}, len(gs.ConsensusAddrsToPrune)) + addrsMap = make(map[string]struct{}) + for _, obj := range gs.ConsensusAddrsToPrune { + epoch := obj.Epoch + if _, ok := epochs[epoch]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate epoch %d", epoch, + ) + } + epochs[epoch] = struct{}{} + if epoch <= 1 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "epoch %d should be > 1", epoch, + ) + } + addrs := obj.ConsAddrs + if len(addrs) == 0 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "empty consensus addresses for epoch %d", epoch, + ) + } + for _, addr := range addrs { + if _, err := sdk.ConsAddressFromBech32(addr); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid consensus address %s: %s", + addr, err, + ) + } + if _, ok := addrsMap[addr]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate consensus address %s", addr, + ) + } + addrsMap[addr] = struct{}{} + } + } + + epochs = make(map[int64]struct{}, len(gs.UndelegationMaturities)) + recordKeysMap := make(map[string]struct{}) + for _, obj := range gs.UndelegationMaturities { + epoch := obj.Epoch + if _, ok := epochs[epoch]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate epoch %d", epoch, + ) + } + if epoch <= 1 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "epoch %d should be > 1", epoch, + ) + } + epochs[epoch] = struct{}{} + recordKeys := obj.UndelegationRecordKeys + if len(recordKeys) == 0 { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "empty record keys for epoch %d", epoch, + ) + } + for _, recordKey := range recordKeys { + if _, ok := recordKeysMap[recordKey]; ok { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "duplicate record key %s", recordKey, + ) + } + if recordBytes, err := hexutil.Decode(recordKey); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid record key (non hex) %s: %s", + recordKey, err, + ) + } else if _, err := delegationtypes.ParseUndelegationRecordKey(recordBytes); err != nil { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "invalid record key (parse) %s: %s", + recordKey, err, + ) + } + recordKeysMap[recordKey] = struct{}{} + } + } + + if gs.LastTotalPower.IsNil() { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "nil last total power", + ) + } + + if !gs.LastTotalPower.IsPositive() { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "non-positive last total power %s", + gs.LastTotalPower, + ) + } + + if !gs.LastTotalPower.Equal(math.NewInt(totalPower)) { + return errorsmod.Wrapf( + ErrInvalidGenesisData, + "last total power mismatch %s, expected %d", + gs.LastTotalPower, totalPower, + ) } return gs.Params.Validate() diff --git a/x/dogfood/types/genesis.pb.go b/x/dogfood/types/genesis.pb.go index e900011d4..ae2a4b767 100644 --- a/x/dogfood/types/genesis.pb.go +++ b/x/dogfood/types/genesis.pb.go @@ -5,6 +5,8 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -23,12 +25,32 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GenesisState defines the dogfood module's genesis state. +// GenesisState defines the dogfood module's genesis state. Note that, as always, +// `genesis` is a misnomer. Ideally, this state can be exported at any point in +// time (or height), and reimported elsewhere where it will be the new genesis +// potentially at a non-zero height. In other words, it is the entire, current, +// state of the module. type GenesisState struct { // params refers to the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - // initial_val_set is the initial validator set. - InitialValSet []GenesisValidator `protobuf:"bytes,2,rep,name=initial_val_set,json=initialValSet,proto3" json:"initial_val_set"` + // val_set is the initial validator set. it onyl represents the active + // validators. + ValSet []GenesisValidator `protobuf:"bytes,2,rep,name=val_set,json=valSet,proto3" json:"val_set"` + // opt_out_expiries is a list of (future) epochs at the end of which the + // corresponding operators' opt-out will expire. we store this, as well as its reverse + // lookup. + OptOutExpiries []EpochToOperatorAddrs `protobuf:"bytes,3,rep,name=opt_out_expiries,json=optOutExpiries,proto3" json:"opt_out_expiries"` + // epochs_consensus_addrs is a list of epochs at the end of which the corresponding + // consensus addresses should be pruned from the operator module. + ConsensusAddrsToPrune []EpochToConsensusAddrs `protobuf:"bytes,4,rep,name=consensus_addrs_to_prune,json=consensusAddrsToPrune,proto3" json:"consensus_addrs_to_prune"` + // undelegation_maturities is a list of epochs at the end of which the corresponding + // undelegations will mature. we store its reverse lookup as well. + UndelegationMaturities []EpochToUndelegationRecordKeys `protobuf:"bytes,5,rep,name=undelegation_maturities,json=undelegationMaturities,proto3" json:"undelegation_maturities"` + // last_total_power tracks the total voting power as of the last validator set + // update. such an update is most likely to be at the end of the last epoch (or the + // beginning of this one, to be more precise) and less likely to be at other blocks, + // since the validator set can otherwise only change as a result of slashing events. + LastTotalPower github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=last_total_power,json=lastTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"last_total_power"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -71,15 +93,40 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetInitialValSet() []GenesisValidator { +func (m *GenesisState) GetValSet() []GenesisValidator { if m != nil { - return m.InitialValSet + return m.ValSet + } + return nil +} + +func (m *GenesisState) GetOptOutExpiries() []EpochToOperatorAddrs { + if m != nil { + return m.OptOutExpiries + } + return nil +} + +func (m *GenesisState) GetConsensusAddrsToPrune() []EpochToConsensusAddrs { + if m != nil { + return m.ConsensusAddrsToPrune + } + return nil +} + +func (m *GenesisState) GetUndelegationMaturities() []EpochToUndelegationRecordKeys { + if m != nil { + return m.UndelegationMaturities } return nil } // GenesisValidator defines a genesis validator. It is a helper struct -// used for serializing the genesis state. +// used for serializing the genesis state. The only reason it is a different +// structure is to support importing hex public keys from Solidity. +// TODO: consider this set up when resolving issue 73 about storage +// optimization between dogfood and operator modules. +// https://github.com/ExocoreNetwork/exocore/issues/73 type GenesisValidator struct { // public_key is the consensus public key of the validator. It should // be exactly 32 bytes, but this is not enforced in protobuf. @@ -135,34 +182,227 @@ func (m *GenesisValidator) GetPower() int64 { return 0 } +// EpochToOperatorAddress is used to store a mapping from epoch to a list of +// operator account addresses. +type EpochToOperatorAddrs struct { + // epoch is the epoch in question. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // operator_acc_addrs is the list of account addresses to expire at this epoch. + // It is of type string for human readability of the genesis file. + OperatorAccAddrs []string `protobuf:"bytes,2,rep,name=operator_acc_addrs,json=operatorAccAddrs,proto3" json:"operator_acc_addrs,omitempty"` +} + +func (m *EpochToOperatorAddrs) Reset() { *m = EpochToOperatorAddrs{} } +func (m *EpochToOperatorAddrs) String() string { return proto.CompactTextString(m) } +func (*EpochToOperatorAddrs) ProtoMessage() {} +func (*EpochToOperatorAddrs) Descriptor() ([]byte, []int) { + return fileDescriptor_1a9d908a27866b1b, []int{2} +} +func (m *EpochToOperatorAddrs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochToOperatorAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochToOperatorAddrs.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EpochToOperatorAddrs) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochToOperatorAddrs.Merge(m, src) +} +func (m *EpochToOperatorAddrs) XXX_Size() int { + return m.Size() +} +func (m *EpochToOperatorAddrs) XXX_DiscardUnknown() { + xxx_messageInfo_EpochToOperatorAddrs.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochToOperatorAddrs proto.InternalMessageInfo + +func (m *EpochToOperatorAddrs) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *EpochToOperatorAddrs) GetOperatorAccAddrs() []string { + if m != nil { + return m.OperatorAccAddrs + } + return nil +} + +// EpochToConsensusAddrs is used to store a mapping from the epoch to a list of +// consensus addresses. +type EpochToConsensusAddrs struct { + // epoch is the epoch in question. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // cons_addrs is the list of consensus addresses to prune at this epoch. + // It is of type string for human readability of the genesis file. + ConsAddrs []string `protobuf:"bytes,2,rep,name=cons_addrs,json=consAddrs,proto3" json:"cons_addrs,omitempty"` +} + +func (m *EpochToConsensusAddrs) Reset() { *m = EpochToConsensusAddrs{} } +func (m *EpochToConsensusAddrs) String() string { return proto.CompactTextString(m) } +func (*EpochToConsensusAddrs) ProtoMessage() {} +func (*EpochToConsensusAddrs) Descriptor() ([]byte, []int) { + return fileDescriptor_1a9d908a27866b1b, []int{3} +} +func (m *EpochToConsensusAddrs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochToConsensusAddrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochToConsensusAddrs.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EpochToConsensusAddrs) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochToConsensusAddrs.Merge(m, src) +} +func (m *EpochToConsensusAddrs) XXX_Size() int { + return m.Size() +} +func (m *EpochToConsensusAddrs) XXX_DiscardUnknown() { + xxx_messageInfo_EpochToConsensusAddrs.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochToConsensusAddrs proto.InternalMessageInfo + +func (m *EpochToConsensusAddrs) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *EpochToConsensusAddrs) GetConsAddrs() []string { + if m != nil { + return m.ConsAddrs + } + return nil +} + +// EpochToUndelegationRecordKeys is used to store a mapping from an epoch to a list of +// undelegations which mature at that epoch. +type EpochToUndelegationRecordKeys struct { + // epoch is the epoch in question. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + // undelegation_record_keys is the list of undelegations (defined by the record key) + // to expire at this epoch. + // It is of type string for human readability of the genesis file. + UndelegationRecordKeys []string `protobuf:"bytes,2,rep,name=undelegation_record_keys,json=undelegationRecordKeys,proto3" json:"undelegation_record_keys,omitempty"` +} + +func (m *EpochToUndelegationRecordKeys) Reset() { *m = EpochToUndelegationRecordKeys{} } +func (m *EpochToUndelegationRecordKeys) String() string { return proto.CompactTextString(m) } +func (*EpochToUndelegationRecordKeys) ProtoMessage() {} +func (*EpochToUndelegationRecordKeys) Descriptor() ([]byte, []int) { + return fileDescriptor_1a9d908a27866b1b, []int{4} +} +func (m *EpochToUndelegationRecordKeys) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EpochToUndelegationRecordKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EpochToUndelegationRecordKeys.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EpochToUndelegationRecordKeys) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochToUndelegationRecordKeys.Merge(m, src) +} +func (m *EpochToUndelegationRecordKeys) XXX_Size() int { + return m.Size() +} +func (m *EpochToUndelegationRecordKeys) XXX_DiscardUnknown() { + xxx_messageInfo_EpochToUndelegationRecordKeys.DiscardUnknown(m) +} + +var xxx_messageInfo_EpochToUndelegationRecordKeys proto.InternalMessageInfo + +func (m *EpochToUndelegationRecordKeys) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *EpochToUndelegationRecordKeys) GetUndelegationRecordKeys() []string { + if m != nil { + return m.UndelegationRecordKeys + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "exocore.dogfood.v1.GenesisState") proto.RegisterType((*GenesisValidator)(nil), "exocore.dogfood.v1.GenesisValidator") + proto.RegisterType((*EpochToOperatorAddrs)(nil), "exocore.dogfood.v1.EpochToOperatorAddrs") + proto.RegisterType((*EpochToConsensusAddrs)(nil), "exocore.dogfood.v1.EpochToConsensusAddrs") + proto.RegisterType((*EpochToUndelegationRecordKeys)(nil), "exocore.dogfood.v1.EpochToUndelegationRecordKeys") } func init() { proto.RegisterFile("exocore/dogfood/v1/genesis.proto", fileDescriptor_1a9d908a27866b1b) } var fileDescriptor_1a9d908a27866b1b = []byte{ - // 302 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xbd, 0x6a, 0x32, 0x41, - 0x18, 0x85, 0x77, 0xf4, 0xfb, 0x04, 0xc7, 0x84, 0x84, 0xc1, 0x42, 0x84, 0x8c, 0x8b, 0xa4, 0xb0, - 0x9a, 0x41, 0xd3, 0xa4, 0x16, 0x82, 0x85, 0x10, 0xc2, 0x0a, 0x16, 0x69, 0x64, 0xd4, 0x37, 0x9b, - 0xc1, 0xd5, 0x77, 0x99, 0x1d, 0xff, 0xee, 0x22, 0x17, 0x90, 0x0b, 0xb2, 0xb4, 0x4c, 0x15, 0x82, - 0xde, 0x48, 0xc8, 0xce, 0x24, 0x45, 0x62, 0x37, 0x3f, 0x0f, 0xcf, 0x39, 0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, 0xc7, 0xda, 0x3e, 0x2f, 0xc7, 0x62, 0x82, 0x73, 0x79, 0xe7, 0x7a, 0xde, 0x83, 0x5d, - 0xa3, 0x99, 0xc9, 0xef, 0xf1, 0x36, 0x3f, 0xf3, 0xd9, 0x6d, 0x0a, 0xd9, 0xb8, 0x94, 0x6f, 0x77, - 0xf3, 0x19, 0x00, 0x00, 0xff, 0xff, 0x94, 0xc2, 0x5a, 0x03, 0xaa, 0x01, 0x00, 0x00, + // 578 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0xc1, 0x4e, 0xdb, 0x30, + 0x18, 0xc7, 0x1b, 0x0a, 0x4c, 0x35, 0x08, 0x75, 0x16, 0x6c, 0x11, 0x12, 0xa1, 0xaa, 0xa6, 0xa9, + 0x9b, 0xb6, 0x44, 0x85, 0x0b, 0x57, 0x40, 0x08, 0x4d, 0x6c, 0x03, 0x05, 0x36, 0x4d, 0x48, 0x53, + 0x64, 0x1c, 0x2f, 0x8d, 0x9a, 0xe6, 0xb3, 0x6c, 0xa7, 0xb4, 0x6f, 0xb1, 0x67, 0xd8, 0x69, 0xc7, + 0x3d, 0x06, 0x47, 0x8e, 0xd3, 0x0e, 0x68, 0x6a, 0x0f, 0x7b, 0x8d, 0xc9, 0x4e, 0x82, 0xda, 0xad, + 0xf4, 0xd2, 0xda, 0x5f, 0xfe, 0xdf, 0xef, 0xef, 0xe4, 0xef, 0x0f, 0x35, 0xd8, 0x00, 0x28, 0x08, + 0xe6, 0x85, 0x10, 0x7d, 0x01, 0x08, 0xbd, 0x7e, 0xdb, 0x8b, 0x58, 0xca, 0x64, 0x2c, 0x5d, 0x2e, + 0x40, 0x01, 0xc6, 0x85, 0xc2, 0x2d, 0x14, 0x6e, 0xbf, 0xbd, 0xf9, 0x98, 0xf4, 0xe2, 0x14, 0x3c, + 0xf3, 0x9b, 0xcb, 0x36, 0xd7, 0x23, 0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0xf2, 0x00, 0x75, 0x0f, 0xd9, 0x53, 0xd1, 0x0b, 0xd3, 0xa0, 0x3f, 0x51, 0xe9, 0x31, + 0x15, 0xe1, 0x44, 0xc0, 0x27, 0x37, 0x23, 0xc7, 0xba, 0x1d, 0x39, 0xd6, 0xef, 0x91, 0x63, 0x7d, + 0x1d, 0x3b, 0x95, 0xdb, 0xb1, 0x53, 0xf9, 0x39, 0x76, 0x2a, 0x97, 0xed, 0x89, 0xe8, 0x8e, 0xf2, + 0x7b, 0xf3, 0x9e, 0xa9, 0x6b, 0x10, 0x5d, 0xaf, 0x9c, 0xee, 0xc1, 0xfd, 0x7c, 0x9b, 0x24, 0xaf, + 0x96, 0xcd, 0x70, 0xef, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x73, 0x71, 0xf4, 0x5e, 0x04, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -185,10 +425,62 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.InitialValSet) > 0 { - for iNdEx := len(m.InitialValSet) - 1; iNdEx >= 0; iNdEx-- { + { + size := m.LastTotalPower.Size() + i -= size + if _, err := m.LastTotalPower.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if len(m.UndelegationMaturities) > 0 { + for iNdEx := len(m.UndelegationMaturities) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UndelegationMaturities[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.ConsensusAddrsToPrune) > 0 { + for iNdEx := len(m.ConsensusAddrsToPrune) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ConsensusAddrsToPrune[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.OptOutExpiries) > 0 { + for iNdEx := len(m.OptOutExpiries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OptOutExpiries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ValSet) > 0 { + for iNdEx := len(m.ValSet) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.InitialValSet[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ValSet[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -247,6 +539,117 @@ func (m *GenesisValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EpochToOperatorAddrs) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EpochToOperatorAddrs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochToOperatorAddrs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorAccAddrs) > 0 { + for iNdEx := len(m.OperatorAccAddrs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.OperatorAccAddrs[iNdEx]) + copy(dAtA[i:], m.OperatorAccAddrs[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.OperatorAccAddrs[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EpochToConsensusAddrs) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EpochToConsensusAddrs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochToConsensusAddrs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConsAddrs) > 0 { + for iNdEx := len(m.ConsAddrs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ConsAddrs[iNdEx]) + copy(dAtA[i:], m.ConsAddrs[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ConsAddrs[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EpochToUndelegationRecordKeys) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EpochToUndelegationRecordKeys) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EpochToUndelegationRecordKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UndelegationRecordKeys) > 0 { + for iNdEx := len(m.UndelegationRecordKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.UndelegationRecordKeys[iNdEx]) + copy(dAtA[i:], m.UndelegationRecordKeys[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.UndelegationRecordKeys[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.Epoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -266,12 +669,32 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.InitialValSet) > 0 { - for _, e := range m.InitialValSet { + if len(m.ValSet) > 0 { + for _, e := range m.ValSet { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.OptOutExpiries) > 0 { + for _, e := range m.OptOutExpiries { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.ConsensusAddrsToPrune) > 0 { + for _, e := range m.ConsensusAddrsToPrune { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.UndelegationMaturities) > 0 { + for _, e := range m.UndelegationMaturities { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } } + l = m.LastTotalPower.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -291,17 +714,71 @@ func (m *GenesisValidator) Size() (n int) { 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 *EpochToOperatorAddrs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovGenesis(uint64(m.Epoch)) + } + if len(m.OperatorAccAddrs) > 0 { + for _, s := range m.OperatorAccAddrs { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n } -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx + +func (m *EpochToConsensusAddrs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovGenesis(uint64(m.Epoch)) + } + if len(m.ConsAddrs) > 0 { + for _, s := range m.ConsAddrs { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *EpochToUndelegationRecordKeys) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovGenesis(uint64(m.Epoch)) + } + if len(m.UndelegationRecordKeys) > 0 { + for _, s := range m.UndelegationRecordKeys { + l = len(s) + 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 { @@ -361,7 +838,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialValSet", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValSet", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -388,8 +865,143 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InitialValSet = append(m.InitialValSet, GenesisValidator{}) - if err := m.InitialValSet[len(m.InitialValSet)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ValSet = append(m.ValSet, GenesisValidator{}) + if err := m.ValSet[len(m.ValSet)-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 OptOutExpiries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptOutExpiries = append(m.OptOutExpiries, EpochToOperatorAddrs{}) + if err := m.OptOutExpiries[len(m.OptOutExpiries)-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 ConsensusAddrsToPrune", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsensusAddrsToPrune = append(m.ConsensusAddrsToPrune, EpochToConsensusAddrs{}) + if err := m.ConsensusAddrsToPrune[len(m.ConsensusAddrsToPrune)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UndelegationMaturities", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UndelegationMaturities = append(m.UndelegationMaturities, EpochToUndelegationRecordKeys{}) + if err := m.UndelegationMaturities[len(m.UndelegationMaturities)-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 LastTotalPower", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LastTotalPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -515,6 +1127,309 @@ func (m *GenesisValidator) Unmarshal(dAtA []byte) error { } return nil } +func (m *EpochToOperatorAddrs) Unmarshal(dAtA []byte) 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: EpochToOperatorAddrs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochToOperatorAddrs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAccAddrs", 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.OperatorAccAddrs = append(m.OperatorAccAddrs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EpochToConsensusAddrs) Unmarshal(dAtA []byte) 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: EpochToConsensusAddrs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochToConsensusAddrs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsAddrs", 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.ConsAddrs = append(m.ConsAddrs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EpochToUndelegationRecordKeys) Unmarshal(dAtA []byte) 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: EpochToUndelegationRecordKeys: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EpochToUndelegationRecordKeys: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UndelegationRecordKeys", 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.UndelegationRecordKeys = append(m.UndelegationRecordKeys, 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 diff --git a/x/dogfood/types/genesis_test.go b/x/dogfood/types/genesis_test.go index df1887f49..a7a129a49 100644 --- a/x/dogfood/types/genesis_test.go +++ b/x/dogfood/types/genesis_test.go @@ -3,8 +3,13 @@ package types_test import ( "testing" + "cosmossdk.io/math" + testutiltx "github.com/ExocoreNetwork/exocore/testutil/tx" + delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/ExocoreNetwork/exocore/x/dogfood/types" "github.com/cometbft/cometbft/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/stretchr/testify/suite" ) @@ -22,11 +27,22 @@ func TestGenesisTestSuite(t *testing.T) { func (suite *GenesisTestSuite) TestValidateGenesis() { sharedKey := hexutil.Encode(ed25519.GenPrivKey().PubKey().Bytes()) + operator1 := sdk.AccAddress(testutiltx.GenerateAddress().Bytes()) + consAddr1 := sdk.ConsAddress(operator1) + recordKey := hexutil.Encode( + delegationtypes.GetUndelegationRecordKey( + 1000, // block height + 1, // layer zero nonce + common.BytesToHash([]byte("tx hash")).Hex(), + operator1.String(), + ), + ) params := types.DefaultParams() testCases := []struct { name string genState *types.GenesisState expPass bool + expError string malleate func(*types.GenesisState) }{ { @@ -34,19 +50,26 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { genState: &types.GenesisState{ Params: params, }, - expPass: true, + expPass: false, // difference between 0 and 1 voting power + expError: "nil last total power", }, { name: "default", genState: types.DefaultGenesis(), - expPass: true, + expPass: false, // 0 voting power isn't permitted + expError: "non-positive last total power", }, { name: "NewGenesis call", genState: types.NewGenesis( params, []types.GenesisValidator{}, + []types.EpochToOperatorAddrs{}, + []types.EpochToConsensusAddrs{}, + []types.EpochToUndelegationRecordKeys{}, + math.ZeroInt(), ), - expPass: true, + expPass: false, // 0 voting power isn't permitted + expError: "non-positive last total power", }, { name: "too many validators", @@ -60,21 +83,25 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { key := hexutil.Encode( ed25519.GenPrivKey().PubKey().Bytes(), ) - gs.InitialValSet = append(gs.InitialValSet, + gs.ValSet = append(gs.ValSet, types.GenesisValidator{ PublicKey: key, Power: 5, }, ) } + gs.LastTotalPower = math.NewInt( + int64(len(gs.ValSet) * 5), + ) }, - expPass: false, + expPass: false, + expError: "too many validators", }, { name: "duplicate keys", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ { PublicKey: sharedKey, Power: 5, @@ -84,64 +111,534 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { Power: 10, }, }, + LastTotalPower: math.NewInt(10), }, - expPass: false, + expPass: false, + expError: "duplicate public key", }, { name: "key with missing 0x prefix", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ { // remove 2 chars and add 2 chars PublicKey: sharedKey[2:] + "ab", Power: 5, }, }, + LastTotalPower: math.NewInt(5), }, - expPass: false, + expPass: false, + expError: "invalid public key", }, { // also covers empty key name: "key with the wrong length", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ { PublicKey: sharedKey + "ab", Power: 5, }, }, + LastTotalPower: math.NewInt(5), }, - expPass: false, + expPass: false, + expError: "invalid public key", }, { name: "non hex key", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ { // replace last 2 chars with non-hex PublicKey: sharedKey[:64] + "ss", Power: 5, }, }, + LastTotalPower: math.NewInt(5), + }, + expPass: false, + expError: "invalid public key", + }, + { + name: "negative vote power", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: -1, + }, + }, + LastTotalPower: math.NewInt(1), }, - expPass: false, + expPass: false, + expError: "invalid power", }, { name: "valid genesis with one validator", genState: &types.GenesisState{ Params: params, - InitialValSet: []types.GenesisValidator{ + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + }, + expPass: true, + }, + { + name: "duplicate epoch in expiries", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + OptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + OperatorAccAddrs: []string{ + operator1.String(), + }, + }, + { + Epoch: 2, + OperatorAccAddrs: []string{ + operator1.String(), + }, + }, + }, + }, + expPass: false, + expError: "duplicate epoch", + }, + { + name: "epoch 1 for expiries", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + OptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 1, + OperatorAccAddrs: []string{ + operator1.String(), + }, + }, + }, + }, + expPass: false, + expError: "should be > 1", + }, + { + name: "empty operator addrs for expiry epoch", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + OptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + }, + }, + }, + expPass: false, + expError: "empty operator addresses for epoch", + }, + { + name: "duplicate addrs for expiry epoch", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + OptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + OperatorAccAddrs: []string{ + operator1.String(), + operator1.String(), + }, + }, + }, + }, + expPass: false, + expError: "duplicate operator address", + }, + { + name: "invalid addr for expiry epoch", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + OptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + OperatorAccAddrs: []string{ + "invalid address", + }, + }, + }, + }, + expPass: false, + expError: "invalid operator address", + }, + { + name: "valid with expiries", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + OptOutExpiries: []types.EpochToOperatorAddrs{ + { + Epoch: 2, + OperatorAccAddrs: []string{ + operator1.String(), + }, + }, + }, + }, + expPass: true, + }, + { + name: "duplicate epoch in pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + ConsAddrs: []string{ + consAddr1.String(), + }, + }, + { + Epoch: 2, + ConsAddrs: []string{ + consAddr1.String(), + }, + }, + }, + }, + expPass: false, + expError: "duplicate epoch", + }, + { + name: "epoch 1 for pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ + { + Epoch: 1, + ConsAddrs: []string{ + consAddr1.String(), + }, + }, + }, + }, + expPass: false, + expError: "should be > 1", + }, + { + name: "empty cons addrs for pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + }, + }, + }, + expPass: false, + expError: "empty consensus addresses for epoch", + }, + { + name: "duplicate cons addrs for pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + ConsAddrs: []string{ + consAddr1.String(), + consAddr1.String(), + }, + }, + }, + }, + expPass: false, + expError: "duplicate consensus address", + }, + { + name: "valid with pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ { PublicKey: sharedKey, Power: 5, }, }, + LastTotalPower: math.NewInt(5), + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + ConsAddrs: []string{ + consAddr1.String(), + }, + }, + }, }, expPass: true, }, + { + name: "invalid cons addrs for pruning", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + ConsensusAddrsToPrune: []types.EpochToConsensusAddrs{ + { + Epoch: 2, + ConsAddrs: []string{ + "invalid cons address", + }, + }, + }, + }, + expPass: false, + expError: "invalid consensus address", + }, + { + name: "duplicate epoch in undelegations", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + recordKey, + }, + }, + { + Epoch: 2, + UndelegationRecordKeys: []string{ + recordKey, + }, + }, + }, + }, + expPass: false, + expError: "duplicate epoch", + }, + { + name: "epoch 1 for undelegations", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 1, + UndelegationRecordKeys: []string{ + recordKey, + }, + }, + }, + }, + expPass: false, + expError: "should be > 1", + }, + { + name: "empty record keys for undelegations", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + }, + }, + }, + expPass: false, + expError: "empty record keys for epoch", + }, + { + name: "duplicate undelegation record keys", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + recordKey, + recordKey, + }, + }, + }, + }, + expPass: false, + expError: "duplicate record key", + }, + { + name: "valid with undelegation record key", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + recordKey, + }, + }, + }, + }, + expPass: true, + }, + { + name: "undelegation record key: not hex", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + "not hex", + }, + }, + }, + }, + expPass: false, + expError: "invalid record key (non hex)", + }, + { + name: "undelegation record key: can't parse", + genState: &types.GenesisState{ + Params: params, + ValSet: []types.GenesisValidator{ + { + PublicKey: sharedKey, + Power: 5, + }, + }, + LastTotalPower: math.NewInt(5), + UndelegationMaturities: []types.EpochToUndelegationRecordKeys{ + { + Epoch: 2, + UndelegationRecordKeys: []string{ + "0x1234", + }, + }, + }, + }, + expPass: false, + expError: "invalid record key (parse)", + }, } for _, tc := range testCases { @@ -154,6 +651,10 @@ func (suite *GenesisTestSuite) TestValidateGenesis() { suite.Require().NoError(err, tc.name) } else { suite.Require().Error(err, tc.name) + suite.Require().Condition(func() bool { + return len(tc.expError) > 0 + }, "expError not set for %s", tc.name) + suite.Require().ErrorContains(err, tc.expError, tc.name) } // fmt.Println(tc.name, err) } diff --git a/x/dogfood/types/hooks.go b/x/dogfood/types/hooks.go index 577c8f5a1..6066557cc 100644 --- a/x/dogfood/types/hooks.go +++ b/x/dogfood/types/hooks.go @@ -31,3 +31,30 @@ func (hooks MultiDogfoodHooks) AfterValidatorBonded( } return nil } + +// AfterValidatorRemoved is the implementation of types.DogfoodHooks for MultiDogfoodHooks. +func (hooks MultiDogfoodHooks) AfterValidatorRemoved( + ctx sdk.Context, + consAddr sdk.ConsAddress, + operator sdk.ValAddress, +) error { + for _, hook := range hooks { + if err := hook.AfterValidatorRemoved(ctx, consAddr, operator); err != nil { + return err + } + } + return nil +} + +// AfterValidatorCreated is the implementation of types.DogfoodHooks for MultiDogfoodHooks. +func (hooks MultiDogfoodHooks) AfterValidatorCreated( + ctx sdk.Context, + operator sdk.ValAddress, +) error { + for _, hook := range hooks { + if err := hook.AfterValidatorCreated(ctx, operator); err != nil { + return err + } + } + return nil +} diff --git a/x/dogfood/types/keys.go b/x/dogfood/types/keys.go index 29f6b2866..05852c96b 100644 --- a/x/dogfood/types/keys.go +++ b/x/dogfood/types/keys.go @@ -1,6 +1,8 @@ package types import ( + math "math" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -16,8 +18,9 @@ const ( // ExocoreValidatorBytePrefix is the prefix for the validator store. ExocoreValidatorBytePrefix byte = iota + 1 - // QueuedOperationsByte is the byte used to store the queue of operations. - QueuedOperationsByte + // QueuedOperationsByte was the byte used to store the queue of operations. + // It is no longer used, but it is retained for backward compatibility. + _ // OptOutsToFinishBytePrefix is the byte used to store the list of operator addresses whose // opt outs are maturing at the provided epoch. @@ -35,9 +38,10 @@ const ( // that will mature at the provided epoch. UnbondingReleaseMaturityBytePrefix - // PendingOperationsByte is the byte used to store the list of operations to be applied at - // the end of the current block. - PendingOperationsByte + // PendingOperationsByte was the byte used to store the list of operations to be applied at + // the end of the current block. It is no longer used, and is retained for backward + // compatibility. + _ // PendingOptOutsByte is the byte used to store the list of operator addresses whose opt // outs will be made effective at the end of the current block. @@ -57,6 +61,9 @@ const ( // HistoricalInfoBytePrefix is the byte prefix for the historical info store. HistoricalInfoBytePrefix + // UndelegationMaturityEpochByte is the byte key for the undelegation maturity epoch store. + UndelegationMaturityEpochByte + // LastTotalPowerByte is the byte key for the last total power store. LastTotalPowerByte @@ -69,11 +76,6 @@ func ExocoreValidatorKey(address sdk.AccAddress) []byte { return append([]byte{ExocoreValidatorBytePrefix}, address.Bytes()...) } -// QueuedOperationsKey returns the key for the queued operations store. -func QueuedOperationsKey() []byte { - return []byte{QueuedOperationsByte} -} - // OptOutsToFinishKey returns the key for the operator opt out maturity store (epoch -> list of // addresses). func OptOutsToFinishKey(epoch int64) ([]byte, bool) { @@ -119,11 +121,6 @@ func UnbondingReleaseMaturityKey(epoch int64) ([]byte, bool) { ), true } -// PendingOperationsKey returns the key for the pending operations store. -func PendingOperationsKey() []byte { - return []byte{PendingOperationsByte} -} - // PendingOptOutsKey returns the key for the pending opt-outs store. func PendingOptOutsKey() []byte { return []byte{PendingOptOutsByte} @@ -145,6 +142,11 @@ func EpochEndKey() []byte { return []byte{EpochEndByte} } +// UndelegationMaturityEpochKey returns the key for the undelegation maturity epoch store. +func UndelegationMaturityEpochKey(recordKey []byte) []byte { + return append([]byte{UndelegationMaturityEpochByte}, recordKey...) +} + // SafeInt64ToUint64 is a wrapper function to convert an int64 // to a uint64. It returns (0, false) if the conversion is not possible. // This is safe as long as the int64 is non-negative. @@ -155,6 +157,16 @@ func SafeInt64ToUint64(id int64) (uint64, bool) { return uint64(id), true // #nosec G701 // already checked. } +// SafeUint64ToInt64 is a wrapper function to convert a uint64 +// to an int64. It returns (0, false) if the conversion is not possible, +// which happens when the uint64 is greater than the maximum int64 value. +func SafeUint64ToInt64(id uint64) (int64, bool) { + if id > math.MaxInt64 { + return 0, false + } + return int64(id), true // #nosec G701 // already checked. +} + // HistoricalInfoKey returns the key to historical info to a given block height func HistoricalInfoKey(height int64) ([]byte, bool) { uheight, ok := SafeInt64ToUint64(height) diff --git a/x/dogfood/types/query.pb.go b/x/dogfood/types/query.pb.go index c1d854133..21c609314 100644 --- a/x/dogfood/types/query.pb.go +++ b/x/dogfood/types/query.pb.go @@ -112,33 +112,397 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// QueryOptOutsToFinishRequest is request type for the Query/OptOutsToFinish RPC method. +type QueryOptOutsToFinishRequest struct { + // epoch is the epoch to query opt-outs for. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` +} + +func (m *QueryOptOutsToFinishRequest) Reset() { *m = QueryOptOutsToFinishRequest{} } +func (m *QueryOptOutsToFinishRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOptOutsToFinishRequest) ProtoMessage() {} +func (*QueryOptOutsToFinishRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e23d51a3dceb1c68, []int{2} +} +func (m *QueryOptOutsToFinishRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOptOutsToFinishRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOptOutsToFinishRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOptOutsToFinishRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOptOutsToFinishRequest.Merge(m, src) +} +func (m *QueryOptOutsToFinishRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOptOutsToFinishRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOptOutsToFinishRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOptOutsToFinishRequest proto.InternalMessageInfo + +func (m *QueryOptOutsToFinishRequest) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +// QueryOperatorOptOutFinishEpochRequest is request type for the Query/OperatorOptOutFinishEpoch +// RPC method. +type QueryOperatorOptOutFinishEpochRequest struct { + // operator_acc_addr is the operator account address. + OperatorAccAddr string `protobuf:"bytes,1,opt,name=operator_acc_addr,json=operatorAccAddr,proto3" json:"operator_acc_addr,omitempty"` +} + +func (m *QueryOperatorOptOutFinishEpochRequest) Reset() { *m = QueryOperatorOptOutFinishEpochRequest{} } +func (m *QueryOperatorOptOutFinishEpochRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorOptOutFinishEpochRequest) ProtoMessage() {} +func (*QueryOperatorOptOutFinishEpochRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e23d51a3dceb1c68, []int{3} +} +func (m *QueryOperatorOptOutFinishEpochRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOperatorOptOutFinishEpochRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorOptOutFinishEpochRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOperatorOptOutFinishEpochRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorOptOutFinishEpochRequest.Merge(m, src) +} +func (m *QueryOperatorOptOutFinishEpochRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorOptOutFinishEpochRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorOptOutFinishEpochRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOperatorOptOutFinishEpochRequest proto.InternalMessageInfo + +func (m *QueryOperatorOptOutFinishEpochRequest) GetOperatorAccAddr() string { + if m != nil { + return m.OperatorAccAddr + } + return "" +} + +// QueryOperatorOptOutFinishEpochResponse is response type for the +// Query/OperatorOptOutFinishEpoch RPC method. +type QueryOperatorOptOutFinishEpochResponse struct { + // epoch is the epoch when the operator's opt-out will finish. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` +} + +func (m *QueryOperatorOptOutFinishEpochResponse) Reset() { + *m = QueryOperatorOptOutFinishEpochResponse{} +} +func (m *QueryOperatorOptOutFinishEpochResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorOptOutFinishEpochResponse) ProtoMessage() {} +func (*QueryOperatorOptOutFinishEpochResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e23d51a3dceb1c68, []int{4} +} +func (m *QueryOperatorOptOutFinishEpochResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOperatorOptOutFinishEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorOptOutFinishEpochResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOperatorOptOutFinishEpochResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorOptOutFinishEpochResponse.Merge(m, src) +} +func (m *QueryOperatorOptOutFinishEpochResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorOptOutFinishEpochResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorOptOutFinishEpochResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOperatorOptOutFinishEpochResponse proto.InternalMessageInfo + +func (m *QueryOperatorOptOutFinishEpochResponse) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +// QueryUndelegationsToMatureRequest is request type for the Query/UndelegationsToMature RPC method. +type QueryUndelegationsToMatureRequest struct { + // epoch is the epoch to query undelegations for. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` +} + +func (m *QueryUndelegationsToMatureRequest) Reset() { *m = QueryUndelegationsToMatureRequest{} } +func (m *QueryUndelegationsToMatureRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUndelegationsToMatureRequest) ProtoMessage() {} +func (*QueryUndelegationsToMatureRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e23d51a3dceb1c68, []int{5} +} +func (m *QueryUndelegationsToMatureRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUndelegationsToMatureRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUndelegationsToMatureRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUndelegationsToMatureRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUndelegationsToMatureRequest.Merge(m, src) +} +func (m *QueryUndelegationsToMatureRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUndelegationsToMatureRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUndelegationsToMatureRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUndelegationsToMatureRequest proto.InternalMessageInfo + +func (m *QueryUndelegationsToMatureRequest) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +// QueryUndelegationMaturityEpochRequest is request type for the Query/UndelegationMaturityEpoch +// RPC method. +type QueryUndelegationMaturityEpochRequest struct { + // record_key is the undelegation record key. note that the UndelegationRecordKey used by the + // delegation module is just a string converted to bytes, which we will reverse here. + RecordKey string `protobuf:"bytes,1,opt,name=record_key,json=recordKey,proto3" json:"record_key,omitempty"` +} + +func (m *QueryUndelegationMaturityEpochRequest) Reset() { *m = QueryUndelegationMaturityEpochRequest{} } +func (m *QueryUndelegationMaturityEpochRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUndelegationMaturityEpochRequest) ProtoMessage() {} +func (*QueryUndelegationMaturityEpochRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e23d51a3dceb1c68, []int{6} +} +func (m *QueryUndelegationMaturityEpochRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUndelegationMaturityEpochRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUndelegationMaturityEpochRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUndelegationMaturityEpochRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUndelegationMaturityEpochRequest.Merge(m, src) +} +func (m *QueryUndelegationMaturityEpochRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUndelegationMaturityEpochRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUndelegationMaturityEpochRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUndelegationMaturityEpochRequest proto.InternalMessageInfo + +func (m *QueryUndelegationMaturityEpochRequest) GetRecordKey() string { + if m != nil { + return m.RecordKey + } + return "" +} + +// QueryUndelegationMaturityEpochResponse is response type for the +// Query/UndelegationMaturityEpoch RPC method. +type QueryUndelegationMaturityEpochResponse struct { + // epoch is the epoch when the undelegation will mature. + Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` +} + +func (m *QueryUndelegationMaturityEpochResponse) Reset() { + *m = QueryUndelegationMaturityEpochResponse{} +} +func (m *QueryUndelegationMaturityEpochResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUndelegationMaturityEpochResponse) ProtoMessage() {} +func (*QueryUndelegationMaturityEpochResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e23d51a3dceb1c68, []int{7} +} +func (m *QueryUndelegationMaturityEpochResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUndelegationMaturityEpochResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUndelegationMaturityEpochResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUndelegationMaturityEpochResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUndelegationMaturityEpochResponse.Merge(m, src) +} +func (m *QueryUndelegationMaturityEpochResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUndelegationMaturityEpochResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUndelegationMaturityEpochResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUndelegationMaturityEpochResponse proto.InternalMessageInfo + +func (m *QueryUndelegationMaturityEpochResponse) GetEpoch() int64 { + if m != nil { + return m.Epoch + } + return 0 +} + +// QueryValidatorRequest is request type for the Query/QueryValidator RPC method. +type QueryValidatorRequest struct { + // cons_addr is the consensus address of the validator being queried. From the perspective of + // this module, the acc_addr is not relevant and is thus not stored. + ConsAddr string `protobuf:"bytes,1,opt,name=cons_addr,json=consAddr,proto3" json:"cons_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_e23d51a3dceb1c68, []int{8} +} +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) GetConsAddr() string { + if m != nil { + return m.ConsAddr + } + return "" +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "exocore.dogfood.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "exocore.dogfood.v1.QueryParamsResponse") + proto.RegisterType((*QueryOptOutsToFinishRequest)(nil), "exocore.dogfood.v1.QueryOptOutsToFinishRequest") + proto.RegisterType((*QueryOperatorOptOutFinishEpochRequest)(nil), "exocore.dogfood.v1.QueryOperatorOptOutFinishEpochRequest") + proto.RegisterType((*QueryOperatorOptOutFinishEpochResponse)(nil), "exocore.dogfood.v1.QueryOperatorOptOutFinishEpochResponse") + proto.RegisterType((*QueryUndelegationsToMatureRequest)(nil), "exocore.dogfood.v1.QueryUndelegationsToMatureRequest") + proto.RegisterType((*QueryUndelegationMaturityEpochRequest)(nil), "exocore.dogfood.v1.QueryUndelegationMaturityEpochRequest") + proto.RegisterType((*QueryUndelegationMaturityEpochResponse)(nil), "exocore.dogfood.v1.QueryUndelegationMaturityEpochResponse") + proto.RegisterType((*QueryValidatorRequest)(nil), "exocore.dogfood.v1.QueryValidatorRequest") } func init() { proto.RegisterFile("exocore/dogfood/v1/query.proto", fileDescriptor_e23d51a3dceb1c68) } var fileDescriptor_e23d51a3dceb1c68 = []byte{ - // 282 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xad, 0xc8, 0x4f, - 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xc9, 0x4f, 0x4f, 0xcb, 0xcf, 0x4f, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, - 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xca, 0xeb, 0x41, - 0xe5, 0xf5, 0xca, 0x0c, 0xa5, 0xe4, 0xb1, 0xe8, 0x29, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x86, 0x68, - 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x33, 0xf5, 0x41, 0x2c, 0xa8, 0xa8, 0x4c, 0x7a, 0x7e, - 0x7e, 0x7a, 0x4e, 0xaa, 0x7e, 0x62, 0x41, 0xa6, 0x7e, 0x62, 0x5e, 0x5e, 0x7e, 0x49, 0x62, 0x49, - 0x66, 0x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0x00, + // 685 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xd1, 0x4e, 0xd4, 0x4c, + 0x14, 0xde, 0xfe, 0xbf, 0x10, 0x18, 0x13, 0x89, 0x23, 0x44, 0x29, 0x5a, 0xb0, 0x51, 0x44, 0x8c, + 0x1d, 0x01, 0x4d, 0x40, 0x13, 0x93, 0x25, 0xc2, 0x85, 0x44, 0xd1, 0x15, 0xbd, 0xf0, 0xa6, 0x29, + 0xed, 0x50, 0x1a, 0xa0, 0xa7, 0xcc, 0x4c, 0x91, 0x95, 0xec, 0x8d, 0x4f, 0xa0, 0xf1, 0xda, 0x6b, + 0x5f, 0xc0, 0x87, 0xe0, 0x92, 0xc4, 0x98, 0x78, 0x45, 0x0c, 0xf8, 0x20, 0xa6, 0x33, 0xd3, 0x75, + 0xd9, 0xed, 0x76, 0x13, 0xef, 0xba, 0x33, 0xe7, 0x3b, 0xe7, 0xfb, 0xce, 0xf9, 0xce, 0x2c, 0xb2, + 0xe8, 0x3e, 0xf8, 0xc0, 0x28, 0x09, 0x20, 0xdc, 0x00, 0x08, 0xc8, 0xde, 0x0c, 0xd9, 0x4d, 0x29, + 0xab, 0x3b, 0x09, 0x03, 0x01, 0x18, 0xeb, 0x7b, 0x47, 0xdf, 0x3b, 0x7b, 0x33, 0xe6, 0x44, 0x01, + 0x26, 0xbf, 0x96, 0x28, 0x73, 0xbc, 0x20, 0x22, 0xf1, 0x98, 0xb7, 0xc3, 0x75, 0xc0, 0x70, 0x08, + 0x21, 0xc8, 0x4f, 0x92, 0x7d, 0xe9, 0xd3, 0xab, 0x21, 0x40, 0xb8, 0x4d, 0x89, 0x97, 0x44, 0xc4, + 0x8b, 0x63, 0x10, 0x9e, 0x88, 0x20, 0xd6, 0x18, 0x7b, 0x18, 0xe1, 0x97, 0x19, 0xb3, 0x17, 0x32, + 0x51, 0x8d, 0xee, 0xa6, 0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x3f, 0x0c, 0x34, 0xda, 0x75, 0x5f, 0x4a, 0xe6, 0xd2, 0x6b, 0x57, 0x4b, 0xe6, 0xd2, 0x73, + 0x3d, 0xed, 0xaa, 0x94, 0xf3, 0x08, 0x2f, 0x94, 0xca, 0x51, 0x52, 0x22, 0x51, 0xcf, 0xa7, 0xf2, + 0xf7, 0x6d, 0x68, 0xe0, 0x4f, 0x06, 0xba, 0x70, 0x76, 0x99, 0xf1, 0xed, 0xae, 0x8c, 0xda, 0x17, + 0xbe, 0x78, 0x11, 0x96, 0xd4, 0x51, 0x33, 0xd8, 0x76, 0x24, 0xcd, 0x29, 0x3c, 0xd9, 0x41, 0x73, + 0x2f, 0x8f, 0x21, 0x07, 0xcd, 0x87, 0xa3, 0xb1, 0xb8, 0x72, 0x78, 0x62, 0x19, 0x47, 0x27, 0x96, + 0xf1, 0xeb, 0xc4, 0x32, 0x3e, 0x9e, 0x5a, 0x95, 0xa3, 0x53, 0xab, 0xf2, 0xf3, 0xd4, 0xaa, 0xbc, + 0x9d, 0x09, 0x23, 0xb1, 0x99, 0xae, 0x3b, 0x3e, 0xec, 0x10, 0x5d, 0xe6, 0x39, 0x15, 0xef, 0x80, + 0x6d, 0x35, 0x53, 0xef, 0x37, 0x93, 0x8b, 0x7a, 0x42, 0xf9, 0x7a, 0xbf, 0xfc, 0x9f, 0x9a, 0xfb, + 0x13, 0x00, 0x00, 0xff, 0xff, 0x59, 0x76, 0xd2, 0xcd, 0x54, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -153,8 +517,18 @@ const _ = grpc.SupportPackageIsVersion4 // // 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 { - // Parameters queries the parameters of the module. + // Params queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // OptOutsToFinish queries the operators whose opt-outs will finish at the given epoch. + OptOutsToFinish(ctx context.Context, in *QueryOptOutsToFinishRequest, opts ...grpc.CallOption) (*AccountAddresses, error) + // OperatorOptOutFinishEpoch queries the epoch when the operator's opt-out will finish. + OperatorOptOutFinishEpoch(ctx context.Context, in *QueryOperatorOptOutFinishEpochRequest, opts ...grpc.CallOption) (*QueryOperatorOptOutFinishEpochResponse, error) + // UndelegationsToMature queries the undelegations that will mature at the given epoch. + UndelegationsToMature(ctx context.Context, in *QueryUndelegationsToMatureRequest, opts ...grpc.CallOption) (*UndelegationRecordKeys, error) + // UndelegationMaturityEpoch queries the epoch when the undelegation will mature. + UndelegationMaturityEpoch(ctx context.Context, in *QueryUndelegationMaturityEpochRequest, opts ...grpc.CallOption) (*QueryUndelegationMaturityEpochResponse, error) + // QueryValidator queries the validator for the given consensus address. + QueryValidator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*ExocoreValidator, error) } type queryClient struct { @@ -174,10 +548,65 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) OptOutsToFinish(ctx context.Context, in *QueryOptOutsToFinishRequest, opts ...grpc.CallOption) (*AccountAddresses, error) { + out := new(AccountAddresses) + err := c.cc.Invoke(ctx, "/exocore.dogfood.v1.Query/OptOutsToFinish", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) OperatorOptOutFinishEpoch(ctx context.Context, in *QueryOperatorOptOutFinishEpochRequest, opts ...grpc.CallOption) (*QueryOperatorOptOutFinishEpochResponse, error) { + out := new(QueryOperatorOptOutFinishEpochResponse) + err := c.cc.Invoke(ctx, "/exocore.dogfood.v1.Query/OperatorOptOutFinishEpoch", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) UndelegationsToMature(ctx context.Context, in *QueryUndelegationsToMatureRequest, opts ...grpc.CallOption) (*UndelegationRecordKeys, error) { + out := new(UndelegationRecordKeys) + err := c.cc.Invoke(ctx, "/exocore.dogfood.v1.Query/UndelegationsToMature", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) UndelegationMaturityEpoch(ctx context.Context, in *QueryUndelegationMaturityEpochRequest, opts ...grpc.CallOption) (*QueryUndelegationMaturityEpochResponse, error) { + out := new(QueryUndelegationMaturityEpochResponse) + err := c.cc.Invoke(ctx, "/exocore.dogfood.v1.Query/UndelegationMaturityEpoch", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryValidator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*ExocoreValidator, error) { + out := new(ExocoreValidator) + err := c.cc.Invoke(ctx, "/exocore.dogfood.v1.Query/QueryValidator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { - // Parameters queries the parameters of the module. + // Params queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // OptOutsToFinish queries the operators whose opt-outs will finish at the given epoch. + OptOutsToFinish(context.Context, *QueryOptOutsToFinishRequest) (*AccountAddresses, error) + // OperatorOptOutFinishEpoch queries the epoch when the operator's opt-out will finish. + OperatorOptOutFinishEpoch(context.Context, *QueryOperatorOptOutFinishEpochRequest) (*QueryOperatorOptOutFinishEpochResponse, error) + // UndelegationsToMature queries the undelegations that will mature at the given epoch. + UndelegationsToMature(context.Context, *QueryUndelegationsToMatureRequest) (*UndelegationRecordKeys, error) + // UndelegationMaturityEpoch queries the epoch when the undelegation will mature. + UndelegationMaturityEpoch(context.Context, *QueryUndelegationMaturityEpochRequest) (*QueryUndelegationMaturityEpochResponse, error) + // QueryValidator queries the validator for the given consensus address. + QueryValidator(context.Context, *QueryValidatorRequest) (*ExocoreValidator, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -187,6 +616,21 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) OptOutsToFinish(ctx context.Context, req *QueryOptOutsToFinishRequest) (*AccountAddresses, error) { + return nil, status.Errorf(codes.Unimplemented, "method OptOutsToFinish not implemented") +} +func (*UnimplementedQueryServer) OperatorOptOutFinishEpoch(ctx context.Context, req *QueryOperatorOptOutFinishEpochRequest) (*QueryOperatorOptOutFinishEpochResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OperatorOptOutFinishEpoch not implemented") +} +func (*UnimplementedQueryServer) UndelegationsToMature(ctx context.Context, req *QueryUndelegationsToMatureRequest) (*UndelegationRecordKeys, error) { + return nil, status.Errorf(codes.Unimplemented, "method UndelegationsToMature not implemented") +} +func (*UnimplementedQueryServer) UndelegationMaturityEpoch(ctx context.Context, req *QueryUndelegationMaturityEpochRequest) (*QueryUndelegationMaturityEpochResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UndelegationMaturityEpoch not implemented") +} +func (*UnimplementedQueryServer) QueryValidator(ctx context.Context, req *QueryValidatorRequest) (*ExocoreValidator, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryValidator not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -210,113 +654,1016 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "exocore.dogfood.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "exocore/dogfood/v1/query.proto", +func _Query_OptOutsToFinish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOptOutsToFinishRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).OptOutsToFinish(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.dogfood.v1.Query/OptOutsToFinish", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OptOutsToFinish(ctx, req.(*QueryOptOutsToFinishRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_OperatorOptOutFinishEpoch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOperatorOptOutFinishEpochRequest) + if err := dec(in); 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]) -} + if interceptor == nil { + return srv.(QueryServer).OperatorOptOutFinishEpoch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.dogfood.v1.Query/OperatorOptOutFinishEpoch", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OperatorOptOutFinishEpoch(ctx, req.(*QueryOperatorOptOutFinishEpochRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_UndelegationsToMature_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUndelegationsToMatureRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UndelegationsToMature(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.dogfood.v1.Query/UndelegationsToMature", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UndelegationsToMature(ctx, req.(*QueryUndelegationsToMatureRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_UndelegationMaturityEpoch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUndelegationMaturityEpochRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UndelegationMaturityEpoch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.dogfood.v1.Query/UndelegationMaturityEpoch", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UndelegationMaturityEpoch(ctx, req.(*QueryUndelegationMaturityEpochRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryValidator_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).QueryValidator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.dogfood.v1.Query/QueryValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryValidator(ctx, req.(*QueryValidatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "exocore.dogfood.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "OptOutsToFinish", + Handler: _Query_OptOutsToFinish_Handler, + }, + { + MethodName: "OperatorOptOutFinishEpoch", + Handler: _Query_OperatorOptOutFinishEpoch_Handler, + }, + { + MethodName: "UndelegationsToMature", + Handler: _Query_UndelegationsToMature_Handler, + }, + { + MethodName: "UndelegationMaturityEpoch", + Handler: _Query_UndelegationMaturityEpoch_Handler, + }, + { + MethodName: "QueryValidator", + Handler: _Query_QueryValidator_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "exocore/dogfood/v1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryOptOutsToFinishRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOptOutsToFinishRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOptOutsToFinishRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Epoch != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorOptOutFinishEpochRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOperatorOptOutFinishEpochRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorOptOutFinishEpochRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorAccAddr) > 0 { + i -= len(m.OperatorAccAddr) + copy(dAtA[i:], m.OperatorAccAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAccAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorOptOutFinishEpochResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOperatorOptOutFinishEpochResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorOptOutFinishEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Epoch != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryUndelegationsToMatureRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryUndelegationsToMatureRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUndelegationsToMatureRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Epoch != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryUndelegationMaturityEpochRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryUndelegationMaturityEpochRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUndelegationMaturityEpochRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RecordKey) > 0 { + i -= len(m.RecordKey) + copy(dAtA[i:], m.RecordKey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RecordKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryUndelegationMaturityEpochResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryUndelegationMaturityEpochResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUndelegationMaturityEpochResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Epoch != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + 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.ConsAddr) > 0 { + i -= len(m.ConsAddr) + copy(dAtA[i:], m.ConsAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryOptOutsToFinishRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovQuery(uint64(m.Epoch)) + } + return n +} + +func (m *QueryOperatorOptOutFinishEpochRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAccAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOperatorOptOutFinishEpochResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovQuery(uint64(m.Epoch)) + } + return n +} + +func (m *QueryUndelegationsToMatureRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovQuery(uint64(m.Epoch)) + } + return n +} + +func (m *QueryUndelegationMaturityEpochRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RecordKey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUndelegationMaturityEpochResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovQuery(uint64(m.Epoch)) + } + return n +} + +func (m *QueryValidatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsAddr) + 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 *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOptOutsToFinishRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOptOutsToFinishRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOptOutsToFinishRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= 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 *QueryOperatorOptOutFinishEpochRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOperatorOptOutFinishEpochRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorOptOutFinishEpochRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAccAddr", 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.OperatorAccAddr = 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 *QueryOperatorOptOutFinishEpochResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOperatorOptOutFinishEpochResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorOptOutFinishEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= 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 + } + } -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 + if iNdEx > l { + return io.ErrUnexpectedEOF } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return nil } - -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 +func (m *QueryUndelegationsToMatureRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryUndelegationsToMatureRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUndelegationsToMatureRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= 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 } - 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++ + if iNdEx > l { + return io.ErrUnexpectedEOF } - dAtA[offset] = uint8(v) - return base + return nil } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryUndelegationMaturityEpochRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryUndelegationMaturityEpochRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUndelegationMaturityEpochRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordKey", 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.RecordKey = 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 + } } - var l int - _ = l - return n -} -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - 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)))) + return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryUndelegationMaturityEpochResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -339,12 +1686,31 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryUndelegationMaturityEpochResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryUndelegationMaturityEpochResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -366,7 +1732,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -389,17 +1755,17 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsAddr", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -409,24 +1775,23 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ConsAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/dogfood/types/query.pb.gw.go b/x/dogfood/types/query.pb.gw.go index cbec494da..e668c708a 100644 --- a/x/dogfood/types/query.pb.gw.go +++ b/x/dogfood/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -49,15 +51,287 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_OptOutsToFinish_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOptOutsToFinishRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch") + } + + protoReq.Epoch, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch", err) + } + + msg, err := client.OptOutsToFinish(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_OptOutsToFinish_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOptOutsToFinishRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch") + } + + protoReq.Epoch, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch", err) + } + + msg, err := server.OptOutsToFinish(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_OperatorOptOutFinishEpoch_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorOptOutFinishEpochRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_acc_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_acc_addr") + } + + protoReq.OperatorAccAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_acc_addr", err) + } + + msg, err := client.OperatorOptOutFinishEpoch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_OperatorOptOutFinishEpoch_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorOptOutFinishEpochRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_acc_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_acc_addr") + } + + protoReq.OperatorAccAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_acc_addr", err) + } + + msg, err := server.OperatorOptOutFinishEpoch(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_UndelegationsToMature_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUndelegationsToMatureRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch") + } + + protoReq.Epoch, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch", err) + } + + msg, err := client.UndelegationsToMature(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UndelegationsToMature_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUndelegationsToMatureRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch") + } + + protoReq.Epoch, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch", err) + } + + msg, err := server.UndelegationsToMature(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_UndelegationMaturityEpoch_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUndelegationMaturityEpochRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["record_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "record_key") + } + + protoReq.RecordKey, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "record_key", err) + } + + msg, err := client.UndelegationMaturityEpoch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UndelegationMaturityEpoch_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUndelegationMaturityEpochRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["record_key"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "record_key") + } + + protoReq.RecordKey, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "record_key", err) + } + + msg, err := server.UndelegationMaturityEpoch(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryValidator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["cons_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cons_addr") + } + + protoReq.ConsAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cons_addr", err) + } + + msg, err := client.QueryValidator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryValidator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["cons_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cons_addr") + } + + protoReq.ConsAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cons_addr", err) + } + + msg, err := server.QueryValidator(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -65,6 +339,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -75,6 +350,121 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_OptOutsToFinish_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_OptOutsToFinish_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OptOutsToFinish_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OperatorOptOutFinishEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_OperatorOptOutFinishEpoch_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OperatorOptOutFinishEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UndelegationsToMature_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_UndelegationsToMature_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UndelegationsToMature_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UndelegationMaturityEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_UndelegationMaturityEpoch_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UndelegationMaturityEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryValidator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryValidator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryValidator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -136,13 +526,133 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_OptOutsToFinish_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_OptOutsToFinish_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OptOutsToFinish_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OperatorOptOutFinishEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_OperatorOptOutFinishEpoch_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OperatorOptOutFinishEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UndelegationsToMature_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_UndelegationsToMature_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UndelegationsToMature_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UndelegationMaturityEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_UndelegationMaturityEpoch_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UndelegationMaturityEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryValidator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryValidator_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryValidator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"exocore", "dogfood", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_OptOutsToFinish_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"exocore", "dogfood", "opt_outs_to_finish", "epoch"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_OperatorOptOutFinishEpoch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"exocore", "dogfood", "operator_opt_out_finish_epoch", "operator_acc_addr"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_UndelegationsToMature_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"exocore", "dogfood", "undelegations_to_mature", "epoch"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_UndelegationMaturityEpoch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"exocore", "dogfood", "undelegation_maturity_epoch", "record_key"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryValidator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"exocore", "dogfood", "validator", "cons_addr"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_OptOutsToFinish_0 = runtime.ForwardResponseMessage + + forward_Query_OperatorOptOutFinishEpoch_0 = runtime.ForwardResponseMessage + + forward_Query_UndelegationsToMature_0 = runtime.ForwardResponseMessage + + forward_Query_UndelegationMaturityEpoch_0 = runtime.ForwardResponseMessage + + forward_Query_QueryValidator_0 = runtime.ForwardResponseMessage ) diff --git a/x/operator/client/cli/query.go b/x/operator/client/cli/query.go index 6f41f7055..28c571036 100644 --- a/x/operator/client/cli/query.go +++ b/x/operator/client/cli/query.go @@ -22,6 +22,11 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand( GetOperatorInfo(), + GetAllOperators(), + GetOperatorConsKey(), + GetOperatorConsAddress(), + GetAllOperatorKeys(), + GetAllOperatorConsAddrs(), ) return cmd } @@ -29,7 +34,7 @@ func GetQueryCmd() *cobra.Command { // GetOperatorInfo queries operator info func GetOperatorInfo() *cobra.Command { cmd := &cobra.Command{ - Use: "GetOperatorInfo operatorAddr", + Use: "get-operator-info operatorAddr", Short: "Get operator info", Long: "Get operator info", Args: cobra.ExactArgs(1), @@ -43,7 +48,7 @@ func GetOperatorInfo() *cobra.Command { req := &operatortypes.GetOperatorInfoReq{ OperatorAddr: args[0], } - res, err := queryClient.GetOperatorInfo(context.Background(), req) + res, err := queryClient.QueryOperatorInfo(context.Background(), req) if err != nil { return err } @@ -54,3 +59,169 @@ func GetOperatorInfo() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +// GetAllOperators queries all operators +func GetAllOperators() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-all-operators", + Short: "Get all operators", + Long: "Get all operator account addresses", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := operatortypes.NewQueryClient(clientCtx) + req := &operatortypes.QueryAllOperatorsRequest{ + Pagination: pageReq, + } + res, err := queryClient.QueryAllOperators(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetOperatorConsKey queries operator consensus key for the provided chain ID +func GetOperatorConsKey() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-operator-cons-key ", + Short: "Get operator consensus key", + Long: "Get operator consensus key for the provided chain ID", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := operatortypes.NewQueryClient(clientCtx) + req := &operatortypes.QueryOperatorConsKeyRequest{ + OperatorAccAddr: args[0], + Chain: args[1], + } + res, err := queryClient.QueryOperatorConsKeyForChainID( + context.Background(), req, + ) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetAllOperatorKeys queries all operators for the provided chain ID and their +// consensus keys +func GetAllOperatorKeys() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-all-operators-by-chain-id ", + Short: "Get all operators for the provided chain ID", + Long: "Get all operators for the provided chain ID", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := operatortypes.NewQueryClient(clientCtx) + req := &operatortypes.QueryAllOperatorConsKeysByChainIDRequest{ + Chain: args[0], + Pagination: pageReq, + } + res, err := queryClient.QueryAllOperatorConsKeysByChainID( + context.Background(), req, + ) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetOperatorConsAddress queries operator consensus address for the provided chain ID +func GetOperatorConsAddress() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-operator-cons-address ", + Short: "Get operator consensus address", + Long: "Get operator consensus address for the provided chain ID", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := operatortypes.NewQueryClient(clientCtx) + req := &operatortypes.QueryOperatorConsAddressRequest{ + OperatorAccAddr: args[0], + Chain: args[1], + } + res, err := queryClient.QueryOperatorConsAddressForChainID( + context.Background(), req, + ) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetAllOperatorConsAddrs queries all operators for the provided chain ID and their +// consensus addresses +func GetAllOperatorConsAddrs() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-all-operator-cons-addrs ", + Short: "Get all operators for the provided chain ID", + Long: "Get all operators for the provided chain ID", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := operatortypes.NewQueryClient(clientCtx) + req := &operatortypes.QueryAllOperatorConsAddrsByChainIDRequest{ + Chain: args[0], + Pagination: pageReq, + } + res, err := queryClient.QueryAllOperatorConsAddrsByChainID( + context.Background(), req, + ) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/operator/client/cli/tx.go b/x/operator/client/cli/tx.go index 31caa4171..b36347d63 100644 --- a/x/operator/client/cli/tx.go +++ b/x/operator/client/cli/tx.go @@ -1,81 +1,259 @@ package cli import ( - "fmt" "strconv" "strings" - errorsmod "cosmossdk.io/errors" - operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" - "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" + flag "github.com/spf13/pflag" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingcli "github.com/cosmos/cosmos-sdk/x/staking/client/cli" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/ExocoreNetwork/exocore/x/operator/types" +) + +const ( + FlagApproveAddr = "approve-addr" + FlagMetaInfo = "meta-info" + FlagClientChainData = "client-chain-data" ) // NewTxCmd returns a root CLI command handler for deposit commands func NewTxCmd() *cobra.Command { txCmd := &cobra.Command{ - Use: operatortypes.ModuleName, - Short: "operator subcommands", + Use: types.ModuleName, + Short: "Operator transaction subcommands", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } txCmd.AddCommand( - RegisterOperator(), + CmdRegisterOperator(), + CmdOptIntoAVS(), + CmdOptOutOfAVS(), + // TODO: while the operator module is storing the consensus keys for now + // are they really a property of the operator or of the respective AVS? + // operator vs dogfood vs appchain coordinator + CmdSetConsKey(), ) return txCmd } -// RegisterOperator register to be a operator -func RegisterOperator() *cobra.Command { +// CmdRegisterOperator returns a CLI command handler for creating a RegisterOperatorReq +// transaction. +func CmdRegisterOperator() *cobra.Command { cmd := &cobra.Command{ - Use: "RegisterOperator EarningsAddr ApproveAddr OperatorMetaInfo clientChainLzID:ClientChainEarningsAddr", - Short: "register to be a operator", - Args: cobra.MinimumNArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - cliCtx, err := client.GetClientTxContext(cmd) + Use: "register-operator", + Short: "register to become an operator", + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - sender := cliCtx.GetFromAddress() - msg := &operatortypes.RegisterOperatorReq{ - FromAddress: sender.String(), - Info: &operatortypes.OperatorInfo{ - EarningsAddr: args[0], - ApproveAddr: args[1], - OperatorMetaInfo: args[2], - }, - } - lastArgs := args[3:] - clientChainEarningAddress := &operatortypes.ClientChainEarningAddrList{} - clientChainEarningAddress.EarningInfoList = make([]*operatortypes.ClientChainEarningAddrInfo, 0) - for _, arg := range lastArgs { - strList := strings.Split(arg, ":") - if len(strList) != 2 { - return errorsmod.Wrap(operatortypes.ErrCliCmdInputArg, fmt.Sprintf("the error input arg is:%s", arg)) - } - clientChainLzID, err := strconv.ParseUint(strList[0], 10, 64) - if err != nil { - return err - } - clientChainEarningAddress.EarningInfoList = append(clientChainEarningAddress.EarningInfoList, - &operatortypes.ClientChainEarningAddrInfo{ - LzClientChainID: clientChainLzID, ClientChainEarningAddr: strList[1], - }) + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err } - msg.Info.ClientChainEarningsAddr = clientChainEarningAddress - if err := msg.ValidateBasic(); err != nil { + + msg, err := newBuildRegisterOperatorMsg(clientCtx, cmd.Flags()) + if err != nil { return err } - return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg) + + // this calls ValidateBasic internally so we don't need to do that. + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } + // EarningsAddr is the same as the sender's address, since the operator registration must be + // done by the operators themselves. + + f := cmd.Flags() + // ApproveAddr may be different from the sender's address. + f.String( + FlagApproveAddr, "", "The address which is used to approve the delegations made to "+ + "the operator. If not provided, it will default to the sender's address.", + ) + // OperatorMetaInfo is the name of the operator. + f.String( + FlagMetaInfo, "", "The operator's meta info (like name)", + ) + // clientChainLzID:ClientChainEarningsAddr + f.StringArray( + FlagClientChainData, []string{}, "The client chain's address to receive earnings; "+ + "can be supplied multiple times. "+ + "Format: :", + ) + f.AddFlagSet(stakingcli.FlagSetCommissionCreate()) + + // transaction level flags from the SDK flags.AddTxFlagsToCmd(cmd) + + // required flags + _ = cmd.MarkFlagRequired(FlagMetaInfo) // name of the operator + + return cmd +} + +func newBuildRegisterOperatorMsg( + clientCtx client.Context, fs *flag.FlagSet, +) (*types.RegisterOperatorReq, error) { + sender := clientCtx.GetFromAddress() + // #nosec G703 // this only errors if the flag isn't defined. + approveAddr, _ := fs.GetString(FlagApproveAddr) + if approveAddr == "" { + approveAddr = sender.String() + } + metaInfo, _ := fs.GetString(FlagMetaInfo) + msg := &types.RegisterOperatorReq{ + FromAddress: sender.String(), + Info: &types.OperatorInfo{ + EarningsAddr: sender.String(), + ApproveAddr: approveAddr, + OperatorMetaInfo: metaInfo, + }, + } + clientChainEarningAddress := &types.ClientChainEarningAddrList{} + // #nosec G703 + ccData, _ := fs.GetStringArray(FlagClientChainData) + clientChainEarningAddress.EarningInfoList = make( + []*types.ClientChainEarningAddrInfo, len(ccData), + ) + for i, arg := range ccData { + strList := strings.Split(arg, ":") + if len(strList) != 2 { + return nil, errorsmod.Wrapf( + types.ErrCliCmdInputArg, "the error input arg is:%s", arg, + ) + } + // note that this is not the hex value but the decimal number. + clientChainLzID, err := strconv.ParseUint(strList[0], 10, 64) + if err != nil { + return nil, errorsmod.Wrapf( + types.ErrCliCmdInputArg, "the error input arg is:%s", arg, + ) + } + clientChainEarningAddress.EarningInfoList[i] = &types.ClientChainEarningAddrInfo{ + LzClientChainID: clientChainLzID, ClientChainEarningAddr: strList[1], + } + } + msg.Info.ClientChainEarningsAddr = clientChainEarningAddress + // get the initial commission parameters + // #nosec G703 + rateStr, _ := fs.GetString(stakingcli.FlagCommissionRate) + // #nosec G703 + maxRateStr, _ := fs.GetString(stakingcli.FlagCommissionMaxRate) + // #nosec G703 + maxChangeRateStr, _ := fs.GetString(stakingcli.FlagCommissionMaxChangeRate) + commission, err := buildCommission(rateStr, maxRateStr, maxChangeRateStr) + if err != nil { + return nil, err + } + msg.Info.Commission = commission + return msg, nil +} + +func buildCommission(rateStr, maxRateStr, maxChangeRateStr string) ( + commission stakingtypes.Commission, err error, +) { + if rateStr == "" || maxRateStr == "" || maxChangeRateStr == "" { + return commission, errorsmod.Wrap( + types.ErrCliCmdInputArg, "must specify all validator commission parameters", + ) + } + + rate, err := sdk.NewDecFromStr(rateStr) + if err != nil { + return commission, err + } + + maxRate, err := sdk.NewDecFromStr(maxRateStr) + if err != nil { + return commission, err + } + + maxChangeRate, err := sdk.NewDecFromStr(maxChangeRateStr) + if err != nil { + return commission, err + } + + commission = stakingtypes.NewCommission(rate, maxRate, maxChangeRate) + + return commission, nil +} + +// CmdOptIntoAVS returns a CLI command handler for creating a OptIntoAVSReq transaction. +func CmdOptIntoAVS() *cobra.Command { + cmd := &cobra.Command{ + Use: "opt-into-avs ", + Short: "opt into an AVS by specifying its address or the chain id, with an optional public key", + Example: "exocore tx operator opt-into-avs exocoretestnet_233-1 $(exocored tendermint show-validator)", + Args: cobra.RangeArgs(1, 2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := &types.OptIntoAVSReq{ + FromAddress: clientCtx.GetFromAddress().String(), + AvsAddress: args[0], + } + if len(args) == 2 { + msg.PublicKey = args[1] + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + return cmd +} + +// CmdOptOutOfAVS returns a CLI command handler for creating a OptOutOfAVSReq transaction. +func CmdOptOutOfAVS() *cobra.Command { + cmd := &cobra.Command{ + Use: "opt-out-of-avs ", + Short: "opt out of an AVS by specifying its address or the chain id", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := &types.OptOutOfAVSReq{ + FromAddress: clientCtx.GetFromAddress().String(), + AvsAddress: args[0], + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + return cmd +} + +// CmdSetConsKey returns a CLI command handler for creating a SetConsKeyReq transaction. +func CmdSetConsKey() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-cons-key ", + Short: "set the consensus key for a chain", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := &types.SetConsKeyReq{ + Address: clientCtx.GetFromAddress().String(), + ChainID: args[0], + PublicKey: args[1], + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } return cmd } diff --git a/x/operator/keeper/abci.go b/x/operator/keeper/abci.go index 8b399709e..57b9e9407 100644 --- a/x/operator/keeper/abci.go +++ b/x/operator/keeper/abci.go @@ -95,21 +95,6 @@ func (k *Keeper) UpdateVotingPower(ctx sdk.Context, avsAddr string) error { return nil } -// ClearPreConsensusPK clears the previous consensus public key for all operators -func (k *Keeper) ClearPreConsensusPK(ctx sdk.Context) error { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator( - store, - []byte{operatortypes.BytePrefixForOperatorAndChainIDToPrevConsKey}, - ) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - store.Delete(iterator.Key()) - } - return nil -} - // EndBlock : update the assets' share when their prices change func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { // todo: need to consider the calling order @@ -123,10 +108,5 @@ func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Valida panic(err) } } - - err = k.ClearPreConsensusPK(ctx) - if err != nil { - panic(err) - } return []abci.ValidatorUpdate{} } diff --git a/x/operator/keeper/consensus_keys.go b/x/operator/keeper/consensus_keys.go index f52599700..2816979d6 100644 --- a/x/operator/keeper/consensus_keys.go +++ b/x/operator/keeper/consensus_keys.go @@ -9,11 +9,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - assetstypes "github.com/ExocoreNetwork/exocore/x/assets/types" delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/ExocoreNetwork/exocore/x/operator/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" ) func (k *Keeper) Logger(ctx sdk.Context) log.Logger { @@ -24,12 +24,10 @@ func (k *Keeper) Logger(ctx sdk.Context) log.Logger { // and chain id. By doing this, an operator is consenting to be an operator on the given chain. // If a key already exists, it will be overwritten and the change in voting power will flow // through to the validator set. -// TODO: Rationalize with k.OptIn func (k *Keeper) SetOperatorConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, - // should be tm-ed25519 consKey *tmprotocrypto.PublicKey, ) error { return k.setOperatorConsKeyForChainID(ctx, opAccAddr, chainID, consKey, false) @@ -45,6 +43,11 @@ func (k *Keeper) setOperatorConsKeyForChainID( consKey *tmprotocrypto.PublicKey, genesis bool, ) error { + // check if the chain id is valid + // TODO: when appchain AVS is implemented, move the check there. + if chainID != ctx.ChainID() { + return types.ErrUnknownChainID + } // check if we are an operator if !k.IsOperator(ctx, opAccAddr) { return delegationtypes.ErrOperatorNotExist @@ -53,22 +56,19 @@ func (k *Keeper) setOperatorConsKeyForChainID( if !genesis && k.slashKeeper.IsOperatorFrozen(ctx, opAccAddr) { return delegationtypes.ErrOperatorIsFrozen } - // check if the chain id is valid - if !k.assetsKeeper.AppChainInfoIsExist(ctx, chainID) { - return assetstypes.ErrUnknownAppChainID + // check if the operator is opted in. it is a 2-step process. + // 1. opt into chainID + // 2. set key for chainID. + // TODO: rationalize this limitation because these two are not atomic. + if !k.IsOptedIn(ctx, opAccAddr.String(), chainID) { + return types.ErrNotOptedIn } - // if opting out, do not allow key replacement - // TODO: merge with the functionality in state_update.go - if k.IsOperatorOptingOutFromChainID(ctx, opAccAddr, chainID) { - return types.ErrAlreadyOptingOut + // if removing key, do not allow key replacement + if k.IsOperatorRemovingKeyFromChainID(ctx, opAccAddr, chainID) { + return types.ErrAlreadyRemovingKey } // convert to bytes - bz, err := consKey.Marshal() - if err != nil { - return errorsmod.Wrap( - err, "SetOperatorConsKeyForChainID: cannot marshal public key", - ) - } + bz := k.cdc.MustMarshal(consKey) // convert to address for reverse lookup consAddr, err := types.TMCryptoPublicKeyToConsAddr(consKey) if err != nil { @@ -76,21 +76,16 @@ func (k *Keeper) setOperatorConsKeyForChainID( err, "SetOperatorConsKeyForChainID: cannot convert pub key to consensus address", ) } - // check if the key is already in use by another operator - // operators may call this function with their own key - // to unjail themselves, so we will allow that. - keyInUse, existingAddr := k.GetOperatorAddressForChainIDAndConsAddr(ctx, chainID, consAddr) + // check if the provided key is already in use by another operator. such use + // also includes whether it was replaced by the same operator. this check ensures + // that a key that has been replaced cannot be used again until it matures. + // even if it is the same operator, do not allow calling this function twice. + keyInUse, _ := k.GetOperatorAddressForChainIDAndConsAddr(ctx, chainID, consAddr) if keyInUse { - if !existingAddr.Equals(opAccAddr) { - return types.ErrConsKeyAlreadyInUse - } + return types.ErrConsKeyAlreadyInUse } // check that such a key is already set. if yes, we will consider it as key replacement. - found, prevKey, err := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) - if err != nil { - // this should not happen - panic(err) - } + found, prevKey := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) var alreadyRecorded bool if found { // ultimately performs bytes.Equal @@ -101,11 +96,7 @@ func (k *Keeper) setOperatorConsKeyForChainID( // if this key is different, we will set the vote power of the old key to 0 // in the validator update. but, we must only do so once in a block, since the // first existing key is the one to replace with 0 vote power and not any others. - alreadyRecorded, _, err = k.getOperatorPrevConsKeyForChainID(ctx, opAccAddr, chainID) - if err != nil { - // this should not happen - panic(err) - } + alreadyRecorded, _ = k.getOperatorPrevConsKeyForChainID(ctx, opAccAddr, chainID) if !alreadyRecorded { if err := k.setOperatorPrevConsKeyForChainID( ctx, opAccAddr, chainID, prevKey, @@ -119,10 +110,10 @@ func (k *Keeper) setOperatorConsKeyForChainID( if !genesis { if found { if !alreadyRecorded { - k.Hooks().AfterOperatorKeyReplacement(ctx, opAccAddr, prevKey, consKey, chainID) + k.Hooks().AfterOperatorKeyReplaced(ctx, opAccAddr, prevKey, consKey, chainID) } } else { - k.Hooks().AfterOperatorOptIn(ctx, opAccAddr, chainID, consKey) + k.Hooks().AfterOperatorKeySet(ctx, opAccAddr, chainID, consKey) } } return nil @@ -175,7 +166,7 @@ func (k *Keeper) setOperatorPrevConsKeyForChainID( ) } store := ctx.KVStore(k.storeKey) - store.Set(types.KeyForOperatorAndChainIDToPrevConsKey(opAccAddr, chainID), bz) + store.Set(types.KeyForChainIDAndOperatorToPrevConsKey(chainID, opAccAddr), bz) return nil } @@ -184,19 +175,17 @@ func (k *Keeper) setOperatorPrevConsKeyForChainID( // to 0 in the validator update. func (k *Keeper) GetOperatorPrevConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, -) (found bool, key *tmprotocrypto.PublicKey, err error) { +) (bool, *tmprotocrypto.PublicKey, error) { // check if we are an operator if !k.IsOperator(ctx, opAccAddr) { - err = delegationtypes.ErrOperatorNotExist - return + return false, nil, delegationtypes.ErrOperatorNotExist } - if !k.assetsKeeper.AppChainInfoIsExist(ctx, chainID) { - err = assetstypes.ErrUnknownAppChainID - return + // check if the chain exists as an AVS + if chainID != ctx.ChainID() { + return false, nil, types.ErrUnknownChainID } - // do not check for slashing here - found, key, err = k.getOperatorPrevConsKeyForChainID(ctx, opAccAddr, chainID) - return + found, key := k.getOperatorPrevConsKeyForChainID(ctx, opAccAddr, chainID) + return found, key, nil } // getOperatorPrevConsKeyForChainID is the internal version of GetOperatorPrevConsKeyForChainID. @@ -205,18 +194,15 @@ func (k *Keeper) getOperatorPrevConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, -) (found bool, key *tmprotocrypto.PublicKey, err error) { +) (bool, *tmprotocrypto.PublicKey) { store := ctx.KVStore(k.storeKey) - res := store.Get(types.KeyForOperatorAndChainIDToPrevConsKey(opAccAddr, chainID)) + res := store.Get(types.KeyForChainIDAndOperatorToPrevConsKey(chainID, opAccAddr)) if res == nil { - return + return false, nil } - key = &tmprotocrypto.PublicKey{} - if err = key.Unmarshal(res); err != nil { - return - } - found = true - return + key := &tmprotocrypto.PublicKey{} + k.cdc.MustUnmarshal(res, key) + return true, key } // GetOperatorConsKeyForChainID gets the (consensus) public key for the given operator address @@ -225,20 +211,16 @@ func (k Keeper) GetOperatorConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, -) (found bool, key *tmprotocrypto.PublicKey, err error) { +) (bool, *tmprotocrypto.PublicKey, error) { // check if we are an operator if !k.IsOperator(ctx, opAccAddr) { - err = delegationtypes.ErrOperatorNotExist - return + return false, nil, delegationtypes.ErrOperatorNotExist } - if !k.assetsKeeper.AppChainInfoIsExist(ctx, chainID) { - err = assetstypes.ErrUnknownAppChainID - return + if chainID != ctx.ChainID() { + return false, nil, types.ErrUnknownChainID } - // do not check for slashing, since this function will be used to update voting power even - // when slashed - found, key, err = k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) - return + found, key := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) + return found, key, nil } // getOperatorConsKeyForChainID is the internal version of GetOperatorConsKeyForChainID. It @@ -247,93 +229,19 @@ func (k *Keeper) getOperatorConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, -) (found bool, key *tmprotocrypto.PublicKey, err error) { +) (bool, *tmprotocrypto.PublicKey) { store := ctx.KVStore(k.storeKey) res := store.Get(types.KeyForOperatorAndChainIDToConsKey(opAccAddr, chainID)) if res == nil { - return + return false, nil } - key = &tmprotocrypto.PublicKey{} - if err = key.Unmarshal(res); err != nil { - return - } - return true, key, nil -} - -// GetChainIDsAndKeysForOperator gets the chain ids for which the given operator address has set -// a -// (consensus) public key. TODO: would it be better to make this a key per operator? -// This is intentionally an array of strings because I don't see the utility for the vote power -// or the public key here. If we need it, we can add it later. -func (k *Keeper) GetChainIDsAndKeysForOperator( - ctx sdk.Context, opAccAddr sdk.AccAddress, -) (chainIDs []string, consKeys []*tmprotocrypto.PublicKey) { - // check if we are an operator - if !k.IsOperator(ctx, opAccAddr) { - return - } - // do not check for slashing here - prefix := types.AppendMany( - []byte{types.BytePrefixForOperatorAndChainIDToConsKey}, - opAccAddr.Bytes(), - ) - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator( - store, prefix, - ) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - // the key returned is the full key, with the prefix. drop the prefix and the length. - chainID := string(iterator.Key()[len(prefix)+8:]) - key := &tmprotocrypto.PublicKey{} - if err := key.Unmarshal(iterator.Value()); err != nil { - // grave error because we are the ones who stored this information in the first - // place - panic(err) - } - chainIDs = append(chainIDs, chainID) - consKeys = append(consKeys, key) - } - return -} - -// GetOperatorsForChainID returns a list of {operatorAddr, pubKey} for the given -// chainID. This is used to create or update the validator set. It skips -// jailed or frozen operators. -func (k *Keeper) GetOperatorsForChainID( - ctx sdk.Context, chainID string, -) (addrs []sdk.AccAddress, pubKeys []*tmprotocrypto.PublicKey) { - if !k.assetsKeeper.AppChainInfoIsExist(ctx, chainID) { - return nil, nil - } - // prefix is the byte prefix and then chainID with length - prefix := types.ChainIDAndAddrKey( - types.BytePrefixForChainIDAndOperatorToConsKey, - chainID, - nil, - ) - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator( - store, prefix, - ) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - // this key is of the format prefix | len | chainID | addr - // and our prefix is of the format prefix | len | chainID - // so just drop it and convert to sdk.AccAddress - addr := iterator.Key()[len(prefix):] - res := iterator.Value() - ret := &tmprotocrypto.PublicKey{} - if err := ret.Unmarshal(res); err != nil { - // grave error - panic(err) - } - addrs = append(addrs, addr) - pubKeys = append(pubKeys, ret) - } - return addrs, pubKeys + key := &tmprotocrypto.PublicKey{} + k.cdc.MustUnmarshal(res, key) + return true, key } +// GetOperatorAddressForChainIDAndConsAddr returns the operator address for the given chain id +// and consensus address. This is used during slashing to find the operator address to slash. func (k Keeper) GetOperatorAddressForChainIDAndConsAddr( ctx sdk.Context, chainID string, consAddr sdk.ConsAddress, ) (found bool, addr sdk.AccAddress) { @@ -347,94 +255,99 @@ func (k Keeper) GetOperatorAddressForChainIDAndConsAddr( return found, addr } -// DeleteOperatorAddressForChainIDAndConsAddr is a pruning method used to delete the -// mapping from chain id and consensus address to operator address. This mapping is used -// to obtain the operator address from its consensus public key, which is sent to the -// coordinator chain by a subscriber chain for slashing. -func (k Keeper) DeleteOperatorAddressForChainIDAndConsAddr( - ctx sdk.Context, chainID string, consAddr sdk.ConsAddress, +// InitiateOperatorKeyRemovalForChainID initiates an operator removing their key from the +// chain id. The caller must validate that the chainID is registered and that the address +// is an operator, that is not frozen, and that the operator is currently opted in. +func (k *Keeper) InitiateOperatorKeyRemovalForChainID( + ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, ) { + // found will always be true, since the operator has registered into the chain + // and during registration a key must be set. + _, key := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) + // we don't check if the operator is already opted out, because this function + // can only be called if the operator is currently opted in. store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyForChainIDAndConsKeyToOperator(chainID, consAddr)) -} - -// SetHooks stores the given hooks implementations. -// Note that the Keeper is changed into a pointer to prevent an ineffective assignment. -func (k *Keeper) SetHooks(hooks types.OperatorHooks) { - if hooks == nil { - panic("cannot set nil hooks") - } - if k.hooks != nil { - panic("cannot set hooks twice") - } - k.hooks = hooks + store.Set(types.KeyForOperatorKeyRemovalForChainID(opAccAddr, chainID), []byte{}) + k.Hooks().AfterOperatorKeyRemovalInitiated(ctx, opAccAddr, chainID, key) } -func (k *Keeper) Hooks() types.OperatorHooks { - if k.hooks == nil { - // return a no-op implementation if no hooks are set to prevent calling nil functions - return types.MultiOperatorHooks{} - } - return k.hooks +// IsOperatorRemovingKeyFromChainID returns true if the operator is removing the consensus +// key from the given chain id. +func (k Keeper) IsOperatorRemovingKeyFromChainID( + ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, +) bool { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.KeyForOperatorKeyRemovalForChainID(opAccAddr, chainID)) + return bz != nil } -// InitiateOperatorOptOutFromChainID initiates an operator opting out from the given chain id. -// It validates whether the operator is registered, and that it is not frozen, and that the -// chain is present within the system. It also checks if the operator is already opting out. -func (k *Keeper) InitiateOperatorOptOutFromChainID( +// CompleteOperatorKeyRemovalForChainID completes the operator key removal from the given +// chain id. +func (k Keeper) CompleteOperatorKeyRemovalForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, ) error { // check if we are an operator if !k.IsOperator(ctx, opAccAddr) { return delegationtypes.ErrOperatorNotExist } - // check for slashing - if k.slashKeeper.IsOperatorFrozen(ctx, opAccAddr) { - return delegationtypes.ErrOperatorIsFrozen + // validate chain id + if chainID != ctx.ChainID() { + return types.ErrUnknownChainID } - // check if the chain id is valid - if !k.assetsKeeper.AppChainInfoIsExist(ctx, chainID) { - return assetstypes.ErrUnknownAppChainID - } - found, key, err := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) - if err != nil { - return err - } - if !found { - return types.ErrNotOptedIn - } - isAlreadyOptingOut := k.IsOperatorOptingOutFromChainID(ctx, opAccAddr, chainID) - if isAlreadyOptingOut { - return types.ErrAlreadyOptingOut + // check if the operator is opting out as we speak + if !k.IsOperatorRemovingKeyFromChainID(ctx, opAccAddr, chainID) { + return types.ErrOperatorNotRemovingKey } store := ctx.KVStore(k.storeKey) - store.Set(types.KeyForOperatorOptOutFromChainID(opAccAddr, chainID), []byte{}) - k.Hooks().AfterOperatorOptOutInitiated(ctx, opAccAddr, chainID, key) + // get previous key to calculate consensus address + _, prevKey := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) + // #nosec G703 // already validated + consAddr, _ := types.TMCryptoPublicKeyToConsAddr(prevKey) + store.Delete(types.KeyForOperatorAndChainIDToConsKey(opAccAddr, chainID)) + store.Delete(types.KeyForChainIDAndOperatorToConsKey(chainID, opAccAddr)) + store.Delete(types.KeyForChainIDAndConsKeyToOperator(chainID, consAddr)) + store.Delete(types.KeyForOperatorKeyRemovalForChainID(opAccAddr, chainID)) return nil } -// IsOperatorOptingOutFromChainID returns true if the operator is opting out from the given -// chain id. -func (k Keeper) IsOperatorOptingOutFromChainID( - ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, -) bool { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyForOperatorOptOutFromChainID(opAccAddr, chainID)) - return bz != nil -} - -// CompleteOperatorOptOutFromChainID completes the operator opting out from the given chain id. -// TODO(mm): would it be better to store as 3 states? (opted in, opting out, opted out) -func (k Keeper) CompleteOperatorOptOutFromChainID( - ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, -) { - if !k.IsOperatorOptingOutFromChainID(ctx, opAccAddr, chainID) { - panic("operator is not opting out") +// GetOperatorsForChainID returns a list of {operatorAddr, pubKey} for the given +// chainID. This is used to create or update the validator set. It includes +// jailed operators, frozen operators and those in the process of opting out. +func (k *Keeper) GetOperatorsForChainID( + ctx sdk.Context, chainID string, +) ([]sdk.AccAddress, []*tmprotocrypto.PublicKey) { + if ctx.ChainID() != chainID { + return nil, nil } + // prefix is the byte prefix and then chainID with length + prefix := types.ChainIDAndAddrKey( + types.BytePrefixForChainIDAndOperatorToConsKey, + chainID, nil, + ) store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyForOperatorOptOutFromChainID(opAccAddr, chainID)) + iterator := sdk.KVStorePrefixIterator( + store, prefix, + ) + defer iterator.Close() + var addrs []sdk.AccAddress + var pubKeys []*tmprotocrypto.PublicKey + for ; iterator.Valid(); iterator.Next() { + // this key is of the format prefix | len | chainID | addr + // and our prefix is of the format prefix | len | chainID + // so just drop it and convert to sdk.AccAddress + addr := iterator.Key()[len(prefix):] + res := iterator.Value() + ret := &tmprotocrypto.PublicKey{} + k.cdc.MustUnmarshal(res, ret) + addrs = append(addrs, addr) + pubKeys = append(pubKeys, ret) + } + return addrs, pubKeys } +// GetActiveOperatorsForChainID should return a list of operators and their public keys. +// These operators are neither jailed, nor frozen, nor opted out, and nor in the process +// of doing so. func (k Keeper) GetActiveOperatorsForChainID( ctx sdk.Context, chainID string, ) ([]sdk.AccAddress, []*tmprotocrypto.PublicKey) { @@ -449,7 +362,7 @@ func (k Keeper) GetActiveOperatorsForChainID( activePks := make([]*tmprotocrypto.PublicKey, 0) // check if the operator is active for i, operator := range operatorsAddr { - if k.IsActive(ctx, operator.String(), avsAddr) { + if k.IsActive(ctx, operator, avsAddr) { activeOperator = append(activeOperator, operator) activePks = append(activePks, pks[i]) } @@ -457,18 +370,66 @@ func (k Keeper) GetActiveOperatorsForChainID( return activeOperator, activePks } +// ValidatorByConsAddrForChainID returns a stakingtypes.ValidatorI for the given consensus +// address and chain id. func (k Keeper) ValidatorByConsAddrForChainID( ctx sdk.Context, consAddr sdk.ConsAddress, chainID string, -) stakingtypes.ValidatorI { +) (stakingtypes.Validator, bool) { found, operatorAddr := k.GetOperatorAddressForChainIDAndConsAddr( ctx, chainID, consAddr, ) if !found { - return stakingtypes.Validator{} + // TODO(mm): create unit tests for the case where a validator + // changes their pub key in the middle of an epoch, resulting + // in a different key. work around that issue here. + return stakingtypes.Validator{}, false + } + found, tmKey, err := k.GetOperatorConsKeyForChainID(ctx, operatorAddr, chainID) + if !found || err != nil { + return stakingtypes.Validator{}, false + } + // since we are sending the address, we have to send the consensus key as well. + // this is because the presence of a non-empty address triggers a call to Validator + // which triggers a call to fetch the consensus key, in the slashing module. + key, err := cryptocodec.FromTmProtoPublicKey(*tmKey) + if err != nil { + return stakingtypes.Validator{}, false + } + val, err := stakingtypes.NewValidator( + sdk.ValAddress(operatorAddr), key, stakingtypes.Description{}, + ) + if err != nil { + return stakingtypes.Validator{}, false } - jailed := k.IsOperatorJailedForChainID(ctx, consAddr, chainID) - return stakingtypes.Validator{ - Jailed: jailed, - OperatorAddress: sdk.ValAddress(operatorAddr).String(), + val.Jailed = k.IsOperatorJailedForChainID(ctx, consAddr, chainID) + return val, true +} + +// DeleteOperatorAddressForChainIDAndConsAddr is a pruning method used to delete the +// mapping from chain id and consensus address to operator address. This mapping is used +// to obtain the operator address from its consensus public key when slashing. +func (k Keeper) DeleteOperatorAddressForChainIDAndConsAddr( + ctx sdk.Context, chainID string, consAddr sdk.ConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.KeyForChainIDAndConsKeyToOperator(chainID, consAddr)) +} + +// ClearPreviousConsensusKeys clears the previous consensus public key for all operators +// of the specified chain. +func (k Keeper) ClearPreviousConsensusKeys(ctx sdk.Context, chainID string) { + partialKey := types.ChainIDWithLenKey(chainID) + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator( + store, + types.AppendMany( + []byte{types.BytePrefixForOperatorAndChainIDToPrevConsKey}, + partialKey, + ), + ) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + store.Delete(iterator.Key()) } } diff --git a/x/operator/keeper/genesis.go b/x/operator/keeper/genesis.go index c7fe9084b..441212898 100644 --- a/x/operator/keeper/genesis.go +++ b/x/operator/keeper/genesis.go @@ -20,9 +20,9 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) []abci.Va for _, detail := range record.Chains { chainID := detail.ChainID // validate that the chain exists - // TODO: move this to the avs keeper when it is merged. - if !k.assetsKeeper.AppChainInfoIsExist(ctx, chainID) { - panic("chain info not found") + // TODO: move this check to the avs keeper when implemented. + if chainID != ctx.ChainID() { + panic("unknown chain id") } // opt into the specified chain (TODO: avs address format) if err := k.OptIn(ctx, operatorAddr, chainID); err != nil { diff --git a/x/operator/keeper/grpc_query.go b/x/operator/keeper/grpc_query.go index 3865c6d36..30040819b 100644 --- a/x/operator/keeper/grpc_query.go +++ b/x/operator/keeper/grpc_query.go @@ -5,28 +5,55 @@ import ( "errors" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" + tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" ) var _ operatortypes.QueryServer = &Keeper{} -func (k *Keeper) GetOperatorInfo(ctx context.Context, req *operatortypes.GetOperatorInfoReq) (*operatortypes.OperatorInfo, error) { +// QueryOperatorInfo queries the operator information for the given address. +func (k *Keeper) QueryOperatorInfo( + ctx context.Context, req *operatortypes.GetOperatorInfoReq, +) (*operatortypes.OperatorInfo, error) { c := sdk.UnwrapSDKContext(ctx) return k.OperatorInfo(c, req.OperatorAddr) } -// QueryOperatorConsKeyForChainID add for dogfood +// QueryAllOperators queries all operators on the chain. +func (k *Keeper) QueryAllOperators( + goCtx context.Context, req *operatortypes.QueryAllOperatorsRequest, +) (*operatortypes.QueryAllOperatorsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + res := make([]string, 0) + store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorInfo) + pageRes, err := query.Paginate(store, req.Pagination, func(key []byte, _ []byte) error { + addr := sdk.AccAddress(key) + res = append(res, addr.String()) + return nil + }) + if err != nil { + return nil, err + } + return &operatortypes.QueryAllOperatorsResponse{ + OperatorAccAddrs: res, + Pagination: pageRes, + }, nil +} + +// QueryOperatorConsKeyForChainID queries the consensus key for the operator on the given chain. func (k *Keeper) QueryOperatorConsKeyForChainID( goCtx context.Context, req *operatortypes.QueryOperatorConsKeyRequest, ) (*operatortypes.QueryOperatorConsKeyResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - addr, err := sdk.AccAddressFromBech32(req.Addr) + addr, err := sdk.AccAddressFromBech32(req.OperatorAccAddr) if err != nil { return nil, err } found, key, err := k.GetOperatorConsKeyForChainID( - ctx, addr, req.ChainId, + ctx, addr, req.Chain, ) if err != nil { return nil, err @@ -36,5 +63,112 @@ func (k *Keeper) QueryOperatorConsKeyForChainID( } return &operatortypes.QueryOperatorConsKeyResponse{ PublicKey: *key, + OptingOut: k.IsOperatorRemovingKeyFromChainID(ctx, addr, req.Chain), + }, nil +} + +// QueryOperatorConsAddressForChainID queries the consensus address for the operator on +// the given chain. +func (k Keeper) QueryOperatorConsAddressForChainID( + goCtx context.Context, + req *operatortypes.QueryOperatorConsAddressRequest, +) (*operatortypes.QueryOperatorConsAddressResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + addr, err := sdk.AccAddressFromBech32(req.OperatorAccAddr) + if err != nil { + return nil, err + } + found, key, err := k.GetOperatorConsKeyForChainID( + ctx, addr, req.Chain, + ) + if err != nil { + return nil, err + } + if !found { + return nil, errors.New("no key assigned") + } + consAddr, err := operatortypes.TMCryptoPublicKeyToConsAddr(key) + if err != nil { + return nil, err + } + return &operatortypes.QueryOperatorConsAddressResponse{ + ConsAddr: consAddr.String(), + OptingOut: k.IsOperatorRemovingKeyFromChainID(ctx, addr, req.Chain), + }, nil +} + +// QueryAllOperatorConsKeysByChainID queries all operators for the given chain and returns +// their consensus keys. +func (k Keeper) QueryAllOperatorConsKeysByChainID( + goCtx context.Context, + req *operatortypes.QueryAllOperatorConsKeysByChainIDRequest, +) (*operatortypes.QueryAllOperatorConsKeysByChainIDResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + res := make([]*operatortypes.OperatorConsKeyPair, 0) + chainPrefix := operatortypes.ChainIDAndAddrKey( + operatortypes.BytePrefixForChainIDAndOperatorToConsKey, + req.Chain, nil, + ) + store := prefix.NewStore(ctx.KVStore(k.storeKey), chainPrefix) + pageRes, err := query.Paginate(store, req.Pagination, func(key []byte, value []byte) error { + addr := sdk.AccAddress(key) + ret := &tmprotocrypto.PublicKey{} + // don't use MustUnmarshal to not panic for queries + if err := ret.Unmarshal(value); err != nil { + return err + } + res = append(res, &operatortypes.OperatorConsKeyPair{ + OperatorAccAddr: addr.String(), + PublicKey: ret, + OptingOut: k.IsOperatorRemovingKeyFromChainID(ctx, addr, req.Chain), + }) + return nil + }) + if err != nil { + return nil, err + } + return &operatortypes.QueryAllOperatorConsKeysByChainIDResponse{ + OperatorConsKeys: res, + Pagination: pageRes, + }, nil +} + +// QueryAllOperatorConsAddrsByChainID queries all operators for the given chain and returns +// their consensus addresses. +func (k Keeper) QueryAllOperatorConsAddrsByChainID( + goCtx context.Context, + req *operatortypes.QueryAllOperatorConsAddrsByChainIDRequest, +) (*operatortypes.QueryAllOperatorConsAddrsByChainIDResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + res := make([]*operatortypes.OperatorConsAddrPair, 0) + chainPrefix := operatortypes.ChainIDAndAddrKey( + operatortypes.BytePrefixForChainIDAndOperatorToConsKey, + req.Chain, nil, + ) + store := prefix.NewStore(ctx.KVStore(k.storeKey), chainPrefix) + pageRes, err := query.Paginate(store, req.Pagination, func(key []byte, value []byte) error { + addr := sdk.AccAddress(key) + ret := &tmprotocrypto.PublicKey{} + // don't use MustUnmarshal to not panic for queries + if err := ret.Unmarshal(value); err != nil { + return err + } + consAddr, err := operatortypes.TMCryptoPublicKeyToConsAddr(ret) + if err != nil { + return err + } + res = append(res, &operatortypes.OperatorConsAddrPair{ + OperatorAccAddr: addr.String(), + ConsAddr: consAddr.String(), + OptingOut: k.IsOperatorRemovingKeyFromChainID(ctx, addr, req.Chain), + }) + return nil + }) + if err != nil { + return nil, err + } + return &operatortypes.QueryAllOperatorConsAddrsByChainIDResponse{ + OperatorConsAddrs: res, + Pagination: pageRes, }, nil } diff --git a/x/operator/keeper/keeper.go b/x/operator/keeper/keeper.go index 11e019bba..144ae2241 100644 --- a/x/operator/keeper/keeper.go +++ b/x/operator/keeper/keeper.go @@ -71,3 +71,24 @@ type OperatorKeeper interface { NoInstantaneousSlash(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr, slashContract, slashID string, occurredSateHeight int64, slashProportion sdkmath.LegacyDec) error } + +// SetHooks stores the given hooks implementations. +// Note that the Keeper is changed into a pointer to prevent an ineffective assignment. +func (k *Keeper) SetHooks(hooks operatortypes.OperatorHooks) { + if hooks == nil { + panic("cannot set nil hooks") + } + if k.hooks != nil { + panic("cannot set hooks twice") + } + k.hooks = hooks +} + +// Hooks returns the keeper's hooks. +func (k *Keeper) Hooks() operatortypes.OperatorHooks { + if k.hooks == nil { + // return a no-op implementation if no hooks are set to prevent calling nil functions + return operatortypes.MultiOperatorHooks{} + } + return k.hooks +} diff --git a/x/operator/keeper/msg_server.go b/x/operator/keeper/msg_server.go index 12c64665e..2f79e3771 100644 --- a/x/operator/keeper/msg_server.go +++ b/x/operator/keeper/msg_server.go @@ -3,71 +3,88 @@ package keeper import ( context "context" + errorsmod "cosmossdk.io/errors" "github.com/ExocoreNetwork/exocore/x/operator/types" sdk "github.com/cosmos/cosmos-sdk/types" ) var _ types.MsgServer = &Keeper{} +// RegisterOperator is an implementation of the msg server for the operator module. func (k *Keeper) RegisterOperator(ctx context.Context, req *types.RegisterOperatorReq) (*types.RegisterOperatorResponse, error) { c := sdk.UnwrapSDKContext(ctx) err := k.SetOperatorInfo(c, req.FromAddress, req.Info) if err != nil { return nil, err } - return nil, nil + return &types.RegisterOperatorResponse{}, nil } -// OptInToCosmosChain this is an RPC for the operators -// that want to service as a validator for the app chain Avs -// The operator can opt in the cosmos app chain through this RPC -// In this function, the basic function `OptIn` need to be called -func (k *Keeper) OptInToCosmosChain( - goCtx context.Context, - req *types.OptInToCosmosChainRequest, -) (*types.OptInToCosmosChainResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - addr, err := sdk.AccAddressFromBech32(req.Address) - if err != nil { - return nil, err +// OptIntoAVS is an implementation of the msg server for the operator module. +func (k Keeper) OptIntoAVS(ctx context.Context, req *types.OptIntoAVSReq) (res *types.OptIntoAVSResponse, err error) { + uncachedCtx := sdk.UnwrapSDKContext(ctx) + // only write if both calls succeed + c, writeFunc := uncachedCtx.CacheContext() + defer func() { + if err == nil { + writeFunc() + } + }() + // TODO: use some form of an AVS to key-type registry here, possibly from within the AVS module to determine + // if a key is required and that it is appropriately supplied. + if req.AvsAddress == c.ChainID() { + if len(req.PublicKey) == 0 { + return nil, errorsmod.Wrap(types.ErrInvalidPubKey, "a key is required but was not supplied") + } + } else { + if len(req.PublicKey) > 0 { + return nil, errorsmod.Wrap(types.ErrInvalidPubKey, "a key is not required but was supplied") + } } - key, err := types.StringToPubKey(req.PublicKey) + // #nosec G703 // already validated + accAddr, _ := sdk.AccAddressFromBech32(req.FromAddress) + err = k.OptIn(c, accAddr, req.AvsAddress) if err != nil { return nil, err } - err = k.SetOperatorConsKeyForChainID( - ctx, addr, req.ChainId, key, - ) - if err != nil { - return nil, err - } - // call the basic OptIn - avsAddr, err := k.avsKeeper.GetAVSAddrByChainID(ctx, req.ChainId) - if err != nil { - return nil, err + if len(req.PublicKey) > 0 { + // we have to validate just the key; we previously validated that ctx.ChainID() == req.AvsAddress + keyObj, _ := types.ValidateConsensusKeyJSON(req.PublicKey) + if err := k.SetOperatorConsKeyForChainID(c, accAddr, req.AvsAddress, keyObj); err != nil { + return nil, err + } } - err = k.OptIn(ctx, addr, avsAddr) - if err != nil { - return nil, err - } - return &types.OptInToCosmosChainResponse{}, nil + return &types.OptIntoAVSResponse{}, nil } -// InitOptOutFromCosmosChain is a method corresponding to OptInToCosmosChain -// It provides a function to opt out from the app chain Avs for the operators. -func (k *Keeper) InitOptOutFromCosmosChain( - goCtx context.Context, - req *types.InitOptOutFromCosmosChainRequest, -) (*types.InitOptOutFromCosmosChainResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - addr, err := sdk.AccAddressFromBech32(req.Address) +// OptOutOfAVS is an implementation of the msg server for the operator module. +func (k Keeper) OptOutOfAVS(ctx context.Context, req *types.OptOutOfAVSReq) (res *types.OptOutOfAVSResponse, err error) { + uncachedCtx := sdk.UnwrapSDKContext(ctx) + // only write if both calls succeed + c, writeFunc := uncachedCtx.CacheContext() + defer func() { + if err == nil { + writeFunc() + } + }() + // #nosec G703 // already validated + accAddr, _ := sdk.AccAddressFromBech32(req.FromAddress) + err = k.OptOut(c, accAddr, req.AvsAddress) if err != nil { return nil, err } - if err := k.InitiateOperatorOptOutFromChainID( - ctx, addr, req.ChainId, - ); err != nil { + return &types.OptOutOfAVSResponse{}, nil +} + +// SetConsKey is an implementation of the msg server for the operator module. +func (k Keeper) SetConsKey(ctx context.Context, req *types.SetConsKeyReq) (*types.SetConsKeyResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + // #nosec G703 // already validated + accAddr, _ := sdk.AccAddressFromBech32(req.Address) + // #nosec G703 // already validated + keyObj, _ := types.ValidateConsensusKeyJSON(req.PublicKey) + if err := k.SetOperatorConsKeyForChainID(c, accAddr, req.ChainID, keyObj); err != nil { return nil, err } - return &types.InitOptOutFromCosmosChainResponse{}, nil + return &types.SetConsKeyResponse{}, nil } diff --git a/x/operator/keeper/operator.go b/x/operator/keeper/operator.go index 5dce5bcfd..20fde39a2 100644 --- a/x/operator/keeper/operator.go +++ b/x/operator/keeper/operator.go @@ -3,28 +3,62 @@ package keeper import ( "fmt" - assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" - errorsmod "cosmossdk.io/errors" - operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + + assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" + operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" ) -// SetOperatorInfo This function is used to register to be an operator in exoCore, the provided info will be stored on the chain. -// Once an address has become an operator,the operator can't return to a normal address.But the operator can update the info through this function -func (k *Keeper) SetOperatorInfo(ctx sdk.Context, addr string, info *operatortypes.OperatorInfo) (err error) { - opAccAddr, err := sdk.AccAddressFromBech32(addr) - if err != nil { - return errorsmod.Wrap(err, "SetOperatorInfo: error occurred when parse acc address from Bech32") +// SetOperatorInfo is used to store the operator's information on the chain. +// There is no current way implemented to delete an operator's registration or edit it. +// TODO: implement operator edit function, which should allow editing: +// approve address? +// commission, subject to limits and once within 24 hours. +// client chain earnings addresses (maybe append only?) +func (k *Keeper) SetOperatorInfo( + ctx sdk.Context, addr string, info *operatortypes.OperatorInfo, +) (err error) { + // the operator's `addr` must match the earnings address. + if addr != info.EarningsAddr { + return errorsmod.Wrap( + operatortypes.ErrParameterInvalid, + "SetOperatorInfo: earnings address is not equal to the operator address", + ) + } + // #nosec G703 // already validated in `ValidateBasic` + opAccAddr, _ := sdk.AccAddressFromBech32(info.EarningsAddr) + // if already registered, this request should go to EditOperator. + if k.IsOperator(ctx, opAccAddr) { + return errorsmod.Wrap( + operatortypes.ErrOperatorAlreadyExists, + fmt.Sprintf("SetOperatorInfo: operator already exists, address: %suite", opAccAddr), + ) + } + // TODO: add minimum commission rate module parameter and check that commission exceeds it. + info.Commission.UpdateTime = ctx.BlockTime() + + if info.ClientChainEarningsAddr != nil { + for _, data := range info.ClientChainEarningsAddr.EarningInfoList { + if data.ClientChainEarningAddr == "" { + return errorsmod.Wrap( + operatortypes.ErrParameterInvalid, + "SetOperatorInfo: client chain earning address is empty", + ) + } + if !k.assetsKeeper.ClientChainExists(ctx, data.LzClientChainID) { + return errorsmod.Wrap( + operatortypes.ErrParameterInvalid, + "SetOperatorInfo: client chain not found", + ) + } + } } - store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorInfo) - // todo: think about the difference between init and update in future - // key := common.HexToAddress(incentive.Contract) + store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorInfo) bz := k.cdc.MustMarshal(info) - // TODO: check about client chain registration for earnings addresses provided? store.Set(opAccAddr, bz) return nil } @@ -123,21 +157,21 @@ func (k *Keeper) IsOptedIn(ctx sdk.Context, operatorAddr, avsAddr string) bool { if err != nil { return false } - if optedInfo.OptedOutHeight != operatortypes.DefaultOptedOutHeight { - return false - } - return true + return optedInfo.OptedOutHeight == operatortypes.DefaultOptedOutHeight } -func (k *Keeper) IsActive(ctx sdk.Context, operatorAddr, avsAddr string) bool { - optedInfo, err := k.GetOptedInfo(ctx, operatorAddr, avsAddr) +func (k *Keeper) IsActive(ctx sdk.Context, operatorAddr sdk.AccAddress, avsAddr string) bool { + optedInfo, err := k.GetOptedInfo(ctx, operatorAddr.String(), avsAddr) if err != nil { + // not opted in return false } if optedInfo.OptedOutHeight != operatortypes.DefaultOptedOutHeight { + // opted out return false } if optedInfo.Jailed { + // frozen - either temporarily or permanently return false } return true diff --git a/x/operator/keeper/operator_info_test.go b/x/operator/keeper/operator_info_test.go index 46f9c56ab..bbf047312 100644 --- a/x/operator/keeper/operator_info_test.go +++ b/x/operator/keeper/operator_info_test.go @@ -21,7 +21,7 @@ func (suite *OperatorTestSuite) TestOperatorInfo() { err := suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), info) suite.NoError(err) - getOperatorInfo, err := suite.App.OperatorKeeper.GetOperatorInfo(suite.Ctx, &operatortype.GetOperatorInfoReq{OperatorAddr: suite.AccAddress.String()}) + getOperatorInfo, err := suite.App.OperatorKeeper.QueryOperatorInfo(suite.Ctx, &operatortype.GetOperatorInfoReq{OperatorAddr: suite.AccAddress.String()}) suite.NoError(err) suite.Equal(*info, *getOperatorInfo) } @@ -29,7 +29,9 @@ func (suite *OperatorTestSuite) TestOperatorInfo() { func (suite *OperatorTestSuite) TestAllOperators() { suite.prepare() operators := []string{suite.operatorAddr.String(), suite.AccAddress.String()} - info := &operatortype.OperatorInfo{} + info := &operatortype.OperatorInfo{ + EarningsAddr: suite.AccAddress.String(), + } err := suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), info) suite.NoError(err) @@ -38,41 +40,43 @@ func (suite *OperatorTestSuite) TestAllOperators() { suite.Contains(getOperators, operators[1]) } -func (suite *OperatorTestSuite) TestHistoricalOperatorInfo() { - height := suite.Ctx.BlockHeight() - info := &operatortype.OperatorInfo{ - EarningsAddr: suite.AccAddress.String(), - ApproveAddr: "", - OperatorMetaInfo: "test operator", - ClientChainEarningsAddr: &operatortype.ClientChainEarningAddrList{ - EarningInfoList: nil, - }, - } - err := suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), info) - suite.NoError(err) - suite.NextBlock() - suite.Equal(height+1, suite.Ctx.BlockHeight(), "nexBlock failed") +// TODO: enable this test when editing operator is implemented. allow for querying +// of the old commission against the new one. +// func (suite *OperatorTestSuite) TestHistoricalOperatorInfo() { +// height := suite.Ctx.BlockHeight() +// info := &operatortype.OperatorInfo{ +// EarningsAddr: suite.AccAddress.String(), +// ApproveAddr: "", +// OperatorMetaInfo: "test operator", +// ClientChainEarningsAddr: &operatortype.ClientChainEarningAddrList{ +// EarningInfoList: nil, +// }, +// } +// err := suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), info) +// suite.NoError(err) +// suite.NextBlock() +// suite.Equal(height+1, suite.Ctx.BlockHeight(), "nexBlock failed") - newInfo := *info - newInfo.OperatorMetaInfo = "new operator" - err = suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), &newInfo) - suite.NoError(err) +// newInfo := *info +// newInfo.OperatorMetaInfo = "new operator" +// err = suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), &newInfo) +// suite.NoError(err) - for i := 0; i < 10; i++ { - suite.NextBlock() - } - // get historical operator info - historicalQueryCtx, err := suite.App.CreateQueryContext(height, false) - suite.NoError(err) - getInfo, err := suite.App.OperatorKeeper.GetOperatorInfo(historicalQueryCtx, &operatortype.GetOperatorInfoReq{ - OperatorAddr: suite.AccAddress.String(), - }) - suite.NoError(err) - suite.Equal(info.OperatorMetaInfo, getInfo.OperatorMetaInfo) +// for i := 0; i < 10; i++ { +// suite.NextBlock() +// } +// // get historical operator info +// historicalQueryCtx, err := suite.App.CreateQueryContext(height, false) +// suite.NoError(err) +// getInfo, err := suite.App.OperatorKeeper.QueryOperatorInfo(historicalQueryCtx, &operatortype.GetOperatorInfoReq{ +// OperatorAddr: suite.AccAddress.String(), +// }) +// suite.NoError(err) +// suite.Equal(info.OperatorMetaInfo, getInfo.OperatorMetaInfo) - getInfo, err = suite.App.OperatorKeeper.GetOperatorInfo(suite.Ctx, &operatortype.GetOperatorInfoReq{ - OperatorAddr: suite.AccAddress.String(), - }) - suite.NoError(err) - suite.Equal(newInfo.OperatorMetaInfo, getInfo.OperatorMetaInfo) -} +// getInfo, err = suite.App.OperatorKeeper.QueryOperatorInfo(suite.Ctx, &operatortype.GetOperatorInfoReq{ +// OperatorAddr: suite.AccAddress.String(), +// }) +// suite.NoError(err) +// suite.Equal(newInfo.OperatorMetaInfo, getInfo.OperatorMetaInfo) +// } diff --git a/x/operator/keeper/opt.go b/x/operator/keeper/opt.go index 0a2a7bf6b..1c474a447 100644 --- a/x/operator/keeper/opt.go +++ b/x/operator/keeper/opt.go @@ -5,6 +5,7 @@ import ( sdkmath "cosmossdk.io/math" + delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/ExocoreNetwork/exocore/x/operator/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -17,9 +18,11 @@ type AssetPriceAndDecimal struct { // OptIn call this function to opt in AVS func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { - // avsAddr should be an evm contract address - if common.IsHexAddress(avsAddr) { - return types.ErrInvalidAvsAddr + // avsAddr should be an evm contract address or a chain id. + if !common.IsHexAddress(avsAddr) { + if avsAddr != ctx.ChainID() { // TODO: other chain ids besides this chain's. + return types.ErrInvalidAvsAddr + } } // check optedIn info if k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { @@ -54,16 +57,36 @@ func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr } // OptOut call this function to opt out of AVS -func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { +func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) (err error) { + // avsAddr should be an evm contract address or a chain id. + if !common.IsHexAddress(avsAddr) { + if avsAddr != ctx.ChainID() { // TODO: other chain ids besides this chain's. + return types.ErrInvalidAvsAddr + } + defer func() { + if err == nil { + // does not fail, because it performs no validations, just stores a key-value pair. + // all validations are instead performed by this function. + k.InitiateOperatorKeyRemovalForChainID(ctx, operatorAddress, avsAddr) + } + }() + } + if !k.IsOperator(ctx, operatorAddress) { + return delegationtypes.ErrOperatorNotExist + } // check optedIn info if !k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { return types.ErrNotOptedIn } + // do not allow frozen operators to do anything meaningful + if k.slashKeeper.IsOperatorFrozen(ctx, operatorAddress) { + return delegationtypes.ErrOperatorIsFrozen + } // DeleteOperatorUSDValue, delete the operator voting power, it can facilitate to // update the voting powers of all opted-in operators at the end of epoch. // there isn't going to be any reward for the operator in this opted-out epoch. - err := k.DeleteOperatorUSDValue(ctx, avsAddr, operatorAddress.String()) + err = k.DeleteOperatorUSDValue(ctx, avsAddr, operatorAddress.String()) if err != nil { return err } @@ -72,6 +95,10 @@ func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr handleFunc := func(info *types.OptedInfo) { // #nosec G701 info.OptedOutHeight = uint64(ctx.BlockHeight()) + // the opt out, although is requested now, is made effective at the end of the current epoch. + // so this is not necessarily the OptedOutHeight, rather, it is the OptOutRequestHeight. + // the height is not directly used, beyond ascertaining whether the operator is currently opted in/out. + // so the difference due to the epoch scheduling is not too big a concern. } err = k.HandleOptedInfo(ctx, operatorAddress.String(), avsAddr, handleFunc) if err != nil { diff --git a/x/operator/keeper/opt_test.go b/x/operator/keeper/opt_test.go index f0988b46c..049df7c11 100644 --- a/x/operator/keeper/opt_test.go +++ b/x/operator/keeper/opt_test.go @@ -41,7 +41,7 @@ func (suite *OperatorTestSuite) prepareOperator() { func (suite *OperatorTestSuite) prepareDeposit(assetAddr common.Address, amount sdkmath.Int) { clientChainLzID := uint64(101) - suite.avsAddr = "avsTestAddr" + suite.avsAddr = common.BytesToAddress([]byte("avsTestAddr")).String() suite.assetAddr = assetAddr suite.assetDecimal = 6 suite.clientChainLzID = clientChainLzID @@ -60,12 +60,10 @@ func (suite *OperatorTestSuite) prepareDeposit(assetAddr common.Address, amount suite.NoError(err) } -func (suite *OperatorTestSuite) prepareDelegation(assetAddr common.Address, amount sdkmath.Int) { +func (suite *OperatorTestSuite) prepareDelegation(isDelegation bool, assetAddr common.Address, amount sdkmath.Int) { suite.delegationAmount = amount - // delegate to operator - delegationParam := &delegationtype.DelegationOrUndelegationParams{ + param := &delegationtype.DelegationOrUndelegationParams{ ClientChainLzID: suite.clientChainLzID, - Action: assetstypes.DelegateTo, AssetsAddress: assetAddr[:], OperatorAddress: suite.operatorAddr, StakerAddress: suite.Address[:], @@ -73,7 +71,12 @@ func (suite *OperatorTestSuite) prepareDelegation(assetAddr common.Address, amou LzNonce: 0, TxHash: common.HexToHash("0x24c4a315d757249c12a7a1d7b6fb96261d49deee26f06a3e1787d008b445c3ac"), } - err := suite.App.DelegationKeeper.DelegateTo(suite.Ctx, delegationParam) + var err error + if isDelegation { + err = suite.App.DelegationKeeper.DelegateTo(suite.Ctx, param) + } else { + err = suite.App.DelegationKeeper.UndelegateFrom(suite.Ctx, param) + } suite.NoError(err) } @@ -83,7 +86,7 @@ func (suite *OperatorTestSuite) prepare() { delegationAmount := sdkmath.NewInt(50) suite.prepareOperator() suite.prepareDeposit(usdtAddress, depositAmount) - suite.prepareDelegation(usdtAddress, delegationAmount) + suite.prepareDelegation(true, usdtAddress, delegationAmount) } func (suite *OperatorTestSuite) CheckState(expectedState *StateForCheck) { diff --git a/x/operator/keeper/slash.go b/x/operator/keeper/slash.go index 18194d911..aa0c72057 100644 --- a/x/operator/keeper/slash.go +++ b/x/operator/keeper/slash.go @@ -341,7 +341,7 @@ func (k Keeper) SlashWithInfractionReason( return sdkmath.NewInt(0) } -// IsOperatorJailedForChainID add for dogfood +// IsOperatorJailedForChainID returns whether an operator is jailed for a specific chainID. func (k Keeper) IsOperatorJailedForChainID(ctx sdk.Context, consAddr sdk.ConsAddress, chainID string) bool { found, operatorAddr := k.GetOperatorAddressForChainIDAndConsAddr(ctx, chainID, consAddr) if !found { @@ -392,5 +392,5 @@ func (k Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress, chainID string) // Unjail an operator func (k Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress, chainID string) { - k.SetJailedState(ctx, consAddr, chainID, true) + k.SetJailedState(ctx, consAddr, chainID, false) } diff --git a/x/operator/keeper/usd_value.go b/x/operator/keeper/usd_value.go index 3b9011989..9800e7e15 100644 --- a/x/operator/keeper/usd_value.go +++ b/x/operator/keeper/usd_value.go @@ -170,7 +170,10 @@ func (k *Keeper) BatchUpdateUSDValueForAVSAndOperator(ctx sdk.Context, avsOperat // AVSAddr -> types.DecValueField(the total USD share of specified Avs) // It hasn't been used now. but it can serve as an RPC in the future. func (k *Keeper) GetAVSUSDValue(ctx sdk.Context, avsAddr string) (sdkmath.LegacyDec, error) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixVotingPowerForAVSOperator) + store := prefix.NewStore( + ctx.KVStore(k.storeKey), + operatortypes.KeyPrefixVotingPowerForAVSOperator, + ) var ret operatortypes.DecValueField key := []byte(avsAddr) value := store.Get(key) @@ -217,7 +220,7 @@ func (k Keeper) GetAvgDelegatedValue( } ret := make([]int64, 0) for _, operator := range operators { - usdValue, err := k.GetOperatorUSDValue(ctx, operator.String(), avsAddr) + usdValue, err := k.GetOperatorUSDValue(ctx, avsAddr, operator.String()) if err != nil { return nil, err } diff --git a/x/operator/keeper/usd_value_test.go b/x/operator/keeper/usd_value_test.go index cfd83bc8f..6eb92aa50 100644 --- a/x/operator/keeper/usd_value_test.go +++ b/x/operator/keeper/usd_value_test.go @@ -85,7 +85,7 @@ func (suite *OperatorTestSuite) TestAVSUSDValue() { usdcPrice, err := suite.App.OperatorKeeper.OracleInterface().GetSpecifiedAssetsPrice(suite.Ctx, suite.assetID) suite.NoError(err) delegatedAmount := sdkmath.NewIntWithDecimal(8, 7) - suite.prepareDelegation(usdcAddr, delegatedAmount) + suite.prepareDelegation(true, usdcAddr, delegatedAmount) // updating the new voting power suite.NoError(err) @@ -99,3 +99,54 @@ func (suite *OperatorTestSuite) TestAVSUSDValue() { suite.NoError(err) suite.Equal(expectedUSDvalue, operatorUSDValue) } + +func (suite *OperatorTestSuite) TestVotingPowerForDogFood() { + initialPower := int64(1) + initialAVSUSDValue := sdkmath.LegacyNewDec(2) + initialOperatorUSDValue := sdkmath.LegacyNewDec(1) + addPower := 1 + addUSDValue := sdkmath.LegacyNewDec(1) + + validators := suite.App.StakingKeeper.GetAllExocoreValidators(suite.Ctx) + for _, validator := range validators { + _, isFound := suite.App.StakingKeeper.GetValidatorByConsAddr(suite.Ctx, validator.Address) + suite.True(isFound) + suite.Equal(initialPower, validator.Power) + } + + operators, _ := suite.App.OperatorKeeper.GetActiveOperatorsForChainID(suite.Ctx, suite.Ctx.ChainID()) + allAssets, err := suite.App.AssetsKeeper.GetAllStakingAssetsInfo(suite.Ctx) + suite.NoError(err) + suite.Equal(1, len(allAssets)) + var asset assetstype.AssetInfo + for _, value := range allAssets { + asset = *value.AssetBasicInfo + } + + assetAddr := common.HexToAddress(asset.Address) + depositAmount := sdkmath.NewIntWithDecimal(2, int(asset.Decimals)) + delegationAmount := sdkmath.NewIntWithDecimal(int64(addPower), int(asset.Decimals)) + suite.prepareDeposit(assetAddr, depositAmount) + suite.operatorAddr = operators[0] + suite.prepareDelegation(true, assetAddr, delegationAmount) + + suite.App.OperatorKeeper.EndBlock(suite.Ctx, abci.RequestEndBlock{}) + avsUSDValue, err := suite.App.OperatorKeeper.GetAVSUSDValue(suite.Ctx, suite.Ctx.ChainID()) + suite.NoError(err) + suite.Equal(initialAVSUSDValue.Add(addUSDValue), avsUSDValue) + operatorUSDValue, err := suite.App.OperatorKeeper.GetOperatorUSDValue(suite.Ctx, suite.Ctx.ChainID(), suite.operatorAddr.String()) + suite.NoError(err) + suite.Equal(initialOperatorUSDValue.Add(addUSDValue), operatorUSDValue) + + found, consensusKey, err := suite.App.OperatorKeeper.GetOperatorConsKeyForChainID(suite.Ctx, suite.operatorAddr, suite.Ctx.ChainID()) + suite.NoError(err) + suite.True(found) + + suite.App.StakingKeeper.MarkEpochEnd(suite.Ctx) + validatorUpdates := suite.App.StakingKeeper.EndBlock(suite.Ctx) + suite.Equal(1, len(validatorUpdates)) + for _, update := range validatorUpdates { + suite.Equal(*consensusKey, update.PubKey) + suite.Equal(initialPower+int64(addPower), update.Power) + } +} diff --git a/x/operator/types/codec.go b/x/operator/types/codec.go index 17edd4f33..c070cb825 100644 --- a/x/operator/types/codec.go +++ b/x/operator/types/codec.go @@ -32,8 +32,9 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), &RegisterOperatorReq{}, - &OptInToCosmosChainRequest{}, - &InitOptOutFromCosmosChainRequest{}, + &OptIntoAVSReq{}, + &OptOutOfAVSReq{}, + &SetConsKeyReq{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/operator/types/consensus_keys.go b/x/operator/types/consensus_keys.go index 534409837..b02123877 100644 --- a/x/operator/types/consensus_keys.go +++ b/x/operator/types/consensus_keys.go @@ -41,29 +41,29 @@ func HexStringToPubKey(key string) (*tmprotocrypto.PublicKey, error) { } // StringToPubKey converts a base64-encoded public key to a tendermint public key. -// Typically, this function is fed an input from ParseConsumerKeyFromJSON. -func StringToPubKey(pubKey string) (key *tmprotocrypto.PublicKey, err error) { +// Typically, this function is fed an input from ParseConsensusKeyFromJSON. +func StringToPubKey(pubKey string) (*tmprotocrypto.PublicKey, error) { pubKeyBytes, err := base64.StdEncoding.DecodeString(pubKey) if err != nil { - return + return nil, err } - subscriberTMConsKey := &tmprotocrypto.PublicKey{ + return &tmprotocrypto.PublicKey{ Sum: &tmprotocrypto.PublicKey_Ed25519{ Ed25519: pubKeyBytes, }, - } - return subscriberTMConsKey, nil + }, nil } -// ParseConsumerKeyFromJSON parses the consumer key from a JSON string. +// ParseConsensusKeyFromJSON parses the consensus key from a JSON string. +// It returns the key type and the key itself. // This function replaces deserializing a protobuf any. -func ParseConsumerKeyFromJSON(jsonStr string) (pkType, key string, err error) { +func ParseConsensusKeyFromJSON(jsonStr string) (string, string, error) { type PubKey struct { - Type string `json:"type"` - Key string `json:"value"` + Type string `json:"@type"` + Key string `json:"key"` } var pubKey PubKey - err = json.Unmarshal([]byte(jsonStr), &pubKey) + err := json.Unmarshal([]byte(jsonStr), &pubKey) if err != nil { return "", "", err } @@ -79,3 +79,17 @@ func TMCryptoPublicKeyToConsAddr(k *tmprotocrypto.PublicKey) (sdk.ConsAddress, e } return sdk.GetConsAddress(sdkK), nil } + +// ValidateConsensusKey checks that the key is a JSON with `@type` and `key` keys +// with the former bearing exactly value `/cosmos.crypto.ed25519.PubKey`, and the +// latter being a valid base64-encoded public key. +func ValidateConsensusKeyJSON(key string) (res *tmprotocrypto.PublicKey, err error) { + if keyType, keyString, err := ParseConsensusKeyFromJSON(key); err != nil { + return nil, errorsmod.Wrap(err, "invalid public key") + } else if keyType != "/cosmos.crypto.ed25519.PubKey" { + return nil, errorsmod.Wrap(ErrParameterInvalid, "invalid public key type") + } else if res, err = StringToPubKey(keyString); err != nil { + return nil, errorsmod.Wrap(err, "invalid public key") + } + return res, nil +} diff --git a/x/operator/types/errors.go b/x/operator/types/errors.go index 06311a46e..80c00c2ab 100644 --- a/x/operator/types/errors.go +++ b/x/operator/types/errors.go @@ -58,8 +58,8 @@ var ( "consensus key already in use by another operator", ) - ErrAlreadyOptingOut = errorsmod.Register( - ModuleName, 11, "operator already opting out", + ErrAlreadyRemovingKey = errorsmod.Register( + ModuleName, 11, "operator already removing consensus key", ) ErrInvalidPubKey = errorsmod.Register( @@ -77,18 +77,33 @@ var ( "avs address should be a hex evm contract address", ) - ErrInvalidSlashType = errorsmod.Register( + ErrOperatorAlreadyExists = errorsmod.Register( ModuleName, 15, + "operator already exists", + ) + + ErrUnknownChainID = errorsmod.Register( + ModuleName, 16, + "unknown chain id", + ) + + ErrOperatorNotRemovingKey = errorsmod.Register( + ModuleName, 17, + "operator not removing key", + ) + + ErrInvalidSlashType = errorsmod.Register( + ModuleName, 18, "the slash type is invalid", ) ErrKeyAlreadyExist = errorsmod.Register( - ModuleName, 16, + ModuleName, 19, "the key already exists", ) ErrValueIsNilOrZero = errorsmod.Register( - ModuleName, 17, + ModuleName, 20, "the value is nil or zero", ) ) diff --git a/x/operator/types/expected_keepers.go b/x/operator/types/expected_keepers.go index 102ba46a3..40c66dd7e 100644 --- a/x/operator/types/expected_keepers.go +++ b/x/operator/types/expected_keepers.go @@ -7,6 +7,7 @@ import ( delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" ) var ( @@ -25,7 +26,6 @@ type AssetsKeeper interface { ctx sdk.Context, operator string, assetsFilter map[string]interface{}, f func(assetID string, state *assetstype.OperatorAssetInfo) error, ) error - AppChainInfoIsExist(ctx sdk.Context, chainID string) bool GetOperatorAssetInfos( ctx sdk.Context, operatorAddr sdk.Address, assetsFilter map[string]interface{}, ) (assetsInfo map[string]*assetstype.OperatorAssetInfo, err error) @@ -38,6 +38,7 @@ type AssetsKeeper interface { ctx sdk.Context, operatorAddr sdk.Address, assetID string, changeAmount assetstype.DeltaOperatorSingleAsset, ) (err error) + ClientChainExists(ctx sdk.Context, index uint64) bool GetAllStakingAssetsInfo(ctx sdk.Context) (allAssets map[string]*assetstype.StakingAssetInfo, err error) } @@ -170,9 +171,10 @@ func (a MockAVS) GetAVSMinimumSelfDelegation(_ sdk.Context, _ string) (sdkmath.L } func (a MockAVS) GetEpochEndAVSs(ctx sdk.Context) ([]string, error) { - avsList := make([]string, 0) - avsList = append(avsList, ctx.ChainID(), "avsTestAddr") - return avsList, nil + return []string{ + ctx.ChainID(), + common.BytesToAddress([]byte("avsTestAddr")).String(), + }, nil } func (a MockAVS) GetHeightForVotingPower(_ sdk.Context, _ string, height int64) (int64, error) { @@ -186,7 +188,7 @@ type AVSKeeper interface { // `ContextForHistoricalState` implemented in x/assets/types/general.go GetAVSSupportedAssets(ctx sdk.Context, avsAddr string) (map[string]interface{}, error) GetAVSSlashContract(ctx sdk.Context, avsAddr string) (string, error) - // GetAVSAddrByChainID get the general Avs address for dogfood module. + // GetAVSAddrByChainID converts the chainID to a general EVM-compatible hex address. GetAVSAddrByChainID(ctx sdk.Context, chainID string) (string, error) // GetAVSMinimumSelfDelegation returns the USD value of minimum self delegation, which // is set for operator @@ -200,26 +202,24 @@ type AVSKeeper interface { GetHeightForVotingPower(ctx sdk.Context, avsAddr string, height int64) (int64, error) } -// add for dogfood - type SlashKeeper interface { IsOperatorFrozen(ctx sdk.Context, addr sdk.AccAddress) bool } type OperatorHooks interface { - // This hook is called when an operator opts in to a chain. - AfterOperatorOptIn( + // This hook is called when an operator declares the consensus key for the provided chain. + AfterOperatorKeySet( ctx sdk.Context, addr sdk.AccAddress, chainID string, pubKey *tmprotocrypto.PublicKey, ) - // This hook is called when an operator's consensus key is replaced for - // a chain. - AfterOperatorKeyReplacement( + // This hook is called when an operator's consensus key is replaced for a chain. + AfterOperatorKeyReplaced( ctx sdk.Context, addr sdk.AccAddress, oldKey *tmprotocrypto.PublicKey, newKey *tmprotocrypto.PublicKey, chainID string, ) - // This hook is called when an operator opts out of a chain. - AfterOperatorOptOutInitiated( + // This hook is called when an operator initiates the removal of a consensus key for a + // chain. + AfterOperatorKeyRemovalInitiated( ctx sdk.Context, addr sdk.AccAddress, chainID string, key *tmprotocrypto.PublicKey, ) } diff --git a/x/operator/types/hooks.go b/x/operator/types/hooks.go index ad2b7f9d4..659dea935 100644 --- a/x/operator/types/hooks.go +++ b/x/operator/types/hooks.go @@ -13,18 +13,18 @@ func NewMultiOperatorHooks(hooks ...OperatorHooks) MultiOperatorHooks { return hooks } -func (hooks MultiOperatorHooks) AfterOperatorOptIn( +func (hooks MultiOperatorHooks) AfterOperatorKeySet( ctx sdk.Context, addr sdk.AccAddress, chainID string, pubKey *tmprotocrypto.PublicKey, ) { for _, hook := range hooks { - hook.AfterOperatorOptIn(ctx, addr, chainID, pubKey) + hook.AfterOperatorKeySet(ctx, addr, chainID, pubKey) } } -func (hooks MultiOperatorHooks) AfterOperatorKeyReplacement( +func (hooks MultiOperatorHooks) AfterOperatorKeyReplaced( ctx sdk.Context, addr sdk.AccAddress, oldKey *tmprotocrypto.PublicKey, @@ -32,14 +32,14 @@ func (hooks MultiOperatorHooks) AfterOperatorKeyReplacement( chainID string, ) { for _, hook := range hooks { - hook.AfterOperatorKeyReplacement(ctx, addr, oldKey, newAddr, chainID) + hook.AfterOperatorKeyReplaced(ctx, addr, oldKey, newAddr, chainID) } } -func (hooks MultiOperatorHooks) AfterOperatorOptOutInitiated( +func (hooks MultiOperatorHooks) AfterOperatorKeyRemovalInitiated( ctx sdk.Context, addr sdk.AccAddress, chainID string, key *tmprotocrypto.PublicKey, ) { for _, hook := range hooks { - hook.AfterOperatorOptOutInitiated(ctx, addr, chainID, key) + hook.AfterOperatorKeyRemovalInitiated(ctx, addr, chainID, key) } } diff --git a/x/operator/types/keys.go b/x/operator/types/keys.go index 1c6feb59b..d27f6d49e 100644 --- a/x/operator/types/keys.go +++ b/x/operator/types/keys.go @@ -38,12 +38,25 @@ const ( prefixSlashAssetsState - // add keys for dogfood - BytePrefixForOperatorAndChainIDToConsKey = iota + // BytePrefixForOperatorAndChainIDToConsKey is the prefix to store the consensus key for + // an operator for a chainID. + BytePrefixForOperatorAndChainIDToConsKey + + // BytePrefixForOperatorAndChainIDToPrevConsKey is the prefix to store the previous + // consensus key for an operator for a chainID. BytePrefixForOperatorAndChainIDToPrevConsKey + + // BytePrefixForChainIDAndOperatorToConsKey is the prefix to store the reverse lookup for + // a chainID + operator address to the consensus key. BytePrefixForChainIDAndOperatorToConsKey + + // BytePrefixForChainIDAndConsKeyToOperator is the prefix to store the reverse lookup for + // a chainID + consensus key to the operator address. BytePrefixForChainIDAndConsKeyToOperator - BytePrefixForOperatorOptOutFromChainID + + // BytePrefixForOperatorKeyRemovalForChainID is the prefix to store that the operator with + // the given address is in the process of unbonding their key for the given chainID. + BytePrefixForOperatorKeyRemovalForChainID ) var ( @@ -109,10 +122,10 @@ func KeyForOperatorAndChainIDToConsKey(addr sdk.AccAddress, chainID string) []by ) } -func KeyForOperatorAndChainIDToPrevConsKey(addr sdk.AccAddress, chainID string) []byte { - return AddrAndChainIDKey( +func KeyForChainIDAndOperatorToPrevConsKey(chainID string, addr sdk.AccAddress) []byte { + return ChainIDAndAddrKey( BytePrefixForOperatorAndChainIDToPrevConsKey, - addr, chainID, + chainID, addr, ) } @@ -131,9 +144,9 @@ func KeyForChainIDAndConsKeyToOperator(chainID string, addr sdk.ConsAddress) []b ) } -func KeyForOperatorOptOutFromChainID(addr sdk.AccAddress, chainID string) []byte { +func KeyForOperatorKeyRemovalForChainID(addr sdk.AccAddress, chainID string) []byte { return AppendMany( - []byte{BytePrefixForOperatorOptOutFromChainID}, addr, + []byte{BytePrefixForOperatorKeyRemovalForChainID}, addr, ChainIDWithLenKey(chainID), ) } diff --git a/x/operator/types/msg.go b/x/operator/types/msg.go index 16612cd68..588fb4f16 100644 --- a/x/operator/types/msg.go +++ b/x/operator/types/msg.go @@ -3,17 +3,30 @@ package types import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + "github.com/evmos/evmos/v14/types" ) +const ( + // TypeRegisterOperatorReq is the type for the RegisterOperatorReq message. + TypeRegisterOperatorReq = "register_operator" + // TypeSetConsKeyReq is the type for the SetConsKeyReq message. + TypeSetConsKeyReq = "set_cons_key" + // TypeOptIntoAVSReq is the type for the OptIntoAVSReq message. + TypeOptIntoAVSReq = "opt_into_avs" + // TypeOptOutOfAVSReq is the type for the OptOutOfAVSReq message. + TypeOptOutOfAVSReq = "opt_out_of_avs" +) + +// interface guards var ( _ sdk.Msg = &RegisterOperatorReq{} - - // add for dogfood - _ sdk.Msg = &OptInToCosmosChainRequest{} - _ sdk.Msg = &InitOptOutFromCosmosChainRequest{} + _ sdk.Msg = &OptIntoAVSReq{} + _ sdk.Msg = &OptOutOfAVSReq{} + _ sdk.Msg = &SetConsKeyReq{} ) -// GetSigners returns the expected signers for a MsgUpdateParams message. +// GetSigners returns the expected signers for the message. func (m *RegisterOperatorReq) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.FromAddress) return []sdk.AccAddress{addr} @@ -24,34 +37,131 @@ func (m *RegisterOperatorReq) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.FromAddress); err != nil { return errorsmod.Wrap(err, "invalid from address") } - return nil + return m.Info.ValidateBasic() } -// GetSignBytes implements the LegacyMsg interface. +// Route returns the transaction route. +func (m *RegisterOperatorReq) Route() string { + return RouterKey +} + +// Type returns the transaction type. +func (m *RegisterOperatorReq) Type() string { + return TypeRegisterOperatorReq +} + +// GetSignBytes returns the bytes all expected signers must sign over. func (m *RegisterOperatorReq) GetSignBytes() []byte { - return nil + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) } -func (m *OptInToCosmosChainRequest) GetSigners() []sdk.AccAddress { +// GetSigners returns the expected signers for the message. +func (m *SetConsKeyReq) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Address) return []sdk.AccAddress{addr} } -func (m *OptInToCosmosChainRequest) ValidateBasic() error { +// ValidateBasic does a sanity check of the provided data +func (m *SetConsKeyReq) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Address); err != nil { return errorsmod.Wrap(err, "invalid from address") } + if !types.IsValidChainID(m.ChainID) { + return errorsmod.Wrap(ErrParameterInvalid, "invalid chain id") + } + if _, err := ValidateConsensusKeyJSON(m.PublicKey); err != nil { + return errorsmod.Wrapf(ErrParameterInvalid, "invalid public key because %s", err) + } return nil } -func (m *InitOptOutFromCosmosChainRequest) GetSigners() []sdk.AccAddress { - addr := sdk.MustAccAddressFromBech32(m.Address) +// Route returns the transaction route. +func (m *SetConsKeyReq) Route() string { + return RouterKey +} + +// Type returns the transaction type. +func (m *SetConsKeyReq) Type() string { + return TypeSetConsKeyReq +} + +// GetSignBytes returns the bytes all expected signers must sign over. +func (m *SetConsKeyReq) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) +} + +// GetSigners returns the expected signers for the message. +func (m *OptIntoAVSReq) GetSigners() []sdk.AccAddress { + addr := sdk.MustAccAddressFromBech32(m.FromAddress) return []sdk.AccAddress{addr} } -func (m *InitOptOutFromCosmosChainRequest) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(m.Address); err != nil { +// ValidateBasic does a sanity check of the provided data +func (m *OptIntoAVSReq) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.FromAddress); err != nil { + return errorsmod.Wrap(err, "invalid from address") + } + if m.AvsAddress == "" { + return errorsmod.Wrap(ErrParameterInvalid, "AVS address is empty") + } + // TODO: there is no specific restriction applied on ChainID in Cosmos, so this check + // could potentially be removed. + if !common.IsHexAddress(m.AvsAddress) && !types.IsValidChainID(m.AvsAddress) { + return errorsmod.Wrap( + ErrParameterInvalid, "AVS address is not a valid hex address or chain id", + ) + } + return nil +} + +// Route returns the transaction route. +func (m *OptIntoAVSReq) Route() string { + return RouterKey +} + +// Type returns the transaction type. +func (m *OptIntoAVSReq) Type() string { + return TypeOptIntoAVSReq +} + +// GetSignBytes returns the bytes all expected signers must sign over. +func (m *OptIntoAVSReq) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) +} + +// GetSigners returns the expected signers for the message. +func (m *OptOutOfAVSReq) GetSigners() []sdk.AccAddress { + addr := sdk.MustAccAddressFromBech32(m.FromAddress) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check of the provided data +func (m *OptOutOfAVSReq) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.FromAddress); err != nil { return errorsmod.Wrap(err, "invalid from address") } + if m.AvsAddress == "" { + return errorsmod.Wrap(ErrParameterInvalid, "AVS address is empty") + } + if !common.IsHexAddress(m.AvsAddress) && !types.IsValidChainID(m.AvsAddress) { + return errorsmod.Wrap( + ErrParameterInvalid, "AVS address is not a valid hex address or chain id", + ) + } return nil } + +// Route returns the transaction route. This must be specified for successful signing. +func (m *OptOutOfAVSReq) Route() string { + return RouterKey +} + +// Type returns the transaction type. +func (m *OptOutOfAVSReq) Type() string { + return TypeOptOutOfAVSReq +} + +// GetSignBytes returns the bytes all expected signers must sign over. +func (m *OptOutOfAVSReq) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) +} diff --git a/x/operator/types/query.pb.go b/x/operator/types/query.pb.go index 737635e24..63ed4f8e5 100644 --- a/x/operator/types/query.pb.go +++ b/x/operator/types/query.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" _ "github.com/cosmos/cosmos-proto" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -77,19 +78,122 @@ func (m *GetOperatorInfoReq) GetOperatorAddr() string { return "" } -// QueryOperatorConsKeyRequest is the request to obtain the consensus public key of the operator +// QueryAllOperatorsRequest is the request to obtain all operators. +type QueryAllOperatorsRequest struct { + // pagination related options. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllOperatorsRequest) Reset() { *m = QueryAllOperatorsRequest{} } +func (m *QueryAllOperatorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllOperatorsRequest) ProtoMessage() {} +func (*QueryAllOperatorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{1} +} +func (m *QueryAllOperatorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOperatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOperatorsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllOperatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOperatorsRequest.Merge(m, src) +} +func (m *QueryAllOperatorsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOperatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOperatorsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllOperatorsRequest proto.InternalMessageInfo + +func (m *QueryAllOperatorsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAllOperatorsResponse is the response containing all operator account addresses. +type QueryAllOperatorsResponse struct { + // operators is a list of all operators. + OperatorAccAddrs []string `protobuf:"bytes,1,rep,name=operator_acc_addrs,json=operatorAccAddrs,proto3" json:"operator_acc_addrs,omitempty"` + // pagination related response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllOperatorsResponse) Reset() { *m = QueryAllOperatorsResponse{} } +func (m *QueryAllOperatorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllOperatorsResponse) ProtoMessage() {} +func (*QueryAllOperatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{2} +} +func (m *QueryAllOperatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOperatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOperatorsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllOperatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOperatorsResponse.Merge(m, src) +} +func (m *QueryAllOperatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOperatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOperatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllOperatorsResponse proto.InternalMessageInfo + +func (m *QueryAllOperatorsResponse) GetOperatorAccAddrs() []string { + if m != nil { + return m.OperatorAccAddrs + } + return nil +} + +func (m *QueryAllOperatorsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOperatorConsKeyRequest is a request to obtain the consensus public key of the operator. type QueryOperatorConsKeyRequest struct { - // addr is the ACC address of operator - Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` - // chain_id is the id of the chain served by the operator - ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // operator_acc_addr is the operator account address. + OperatorAccAddr string `protobuf:"bytes,1,opt,name=operator_acc_addr,json=operatorAccAddr,proto3" json:"operator_acc_addr,omitempty"` + // chain is the id of the chain served by the operator. here chain_id is not used since the + // Linter complains about capitalization, which can be set with a gogoproto.custom_name but + // that is not compatible with google.api.http.get in the Query service below. + Chain string `protobuf:"bytes,2,opt,name=chain,proto3" json:"chain,omitempty"` } func (m *QueryOperatorConsKeyRequest) Reset() { *m = QueryOperatorConsKeyRequest{} } func (m *QueryOperatorConsKeyRequest) String() string { return proto.CompactTextString(m) } func (*QueryOperatorConsKeyRequest) ProtoMessage() {} func (*QueryOperatorConsKeyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f91e795a3cecbdbf, []int{1} + return fileDescriptor_f91e795a3cecbdbf, []int{3} } func (m *QueryOperatorConsKeyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -118,31 +222,33 @@ func (m *QueryOperatorConsKeyRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryOperatorConsKeyRequest proto.InternalMessageInfo -func (m *QueryOperatorConsKeyRequest) GetAddr() string { +func (m *QueryOperatorConsKeyRequest) GetOperatorAccAddr() string { if m != nil { - return m.Addr + return m.OperatorAccAddr } return "" } -func (m *QueryOperatorConsKeyRequest) GetChainId() string { +func (m *QueryOperatorConsKeyRequest) GetChain() string { if m != nil { - return m.ChainId + return m.Chain } return "" } -// QueryOperatorConsKeyResponse is the response for QueryOperatorConsKeyRequest +// QueryOperatorConsKeyResponse is the response for QueryOperatorConsKeyRequest. type QueryOperatorConsKeyResponse struct { - // public_key is the consensus public key of the operator + // public_key is the consensus public key of the operator. PublicKey crypto.PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key"` + // opting_out is a flag to indicate if the operator is opting out of consensus. + OptingOut bool `protobuf:"varint,2,opt,name=opting_out,json=optingOut,proto3" json:"opting_out,omitempty"` } func (m *QueryOperatorConsKeyResponse) Reset() { *m = QueryOperatorConsKeyResponse{} } func (m *QueryOperatorConsKeyResponse) String() string { return proto.CompactTextString(m) } func (*QueryOperatorConsKeyResponse) ProtoMessage() {} func (*QueryOperatorConsKeyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f91e795a3cecbdbf, []int{2} + return fileDescriptor_f91e795a3cecbdbf, []int{4} } func (m *QueryOperatorConsKeyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -178,328 +284,2598 @@ func (m *QueryOperatorConsKeyResponse) GetPublicKey() crypto.PublicKey { return crypto.PublicKey{} } -func init() { - proto.RegisterType((*GetOperatorInfoReq)(nil), "exocore.operator.v1.GetOperatorInfoReq") - proto.RegisterType((*QueryOperatorConsKeyRequest)(nil), "exocore.operator.v1.QueryOperatorConsKeyRequest") - proto.RegisterType((*QueryOperatorConsKeyResponse)(nil), "exocore.operator.v1.QueryOperatorConsKeyResponse") +func (m *QueryOperatorConsKeyResponse) GetOptingOut() bool { + if m != nil { + return m.OptingOut + } + return false } -func init() { proto.RegisterFile("exocore/operator/v1/query.proto", fileDescriptor_f91e795a3cecbdbf) } - -var fileDescriptor_f91e795a3cecbdbf = []byte{ - // 483 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0xa3, 0xf2, 0xd1, 0x05, 0x84, 0xb4, 0xf4, 0x90, 0x86, 0xc8, 0x05, 0x1f, 0xa0, 0x17, - 0x76, 0x49, 0x38, 0x73, 0x48, 0xc2, 0x87, 0xa2, 0x56, 0x7c, 0xb8, 0x37, 0x2e, 0x96, 0x63, 0x0f, - 0xae, 0x95, 0x64, 0xc7, 0xd9, 0xdd, 0x94, 0x58, 0x55, 0x2f, 0xdc, 0x91, 0x90, 0xf8, 0x2b, 0xfc, - 0x88, 0x1e, 0x23, 0xb8, 0x70, 0x42, 0x28, 0xe1, 0xc4, 0xaf, 0x40, 0x5e, 0xdb, 0x0d, 0x0a, 0x16, - 0x12, 0x37, 0xef, 0xec, 0x9b, 0xf7, 0x66, 0xde, 0x5b, 0x93, 0x3d, 0x98, 0x63, 0x80, 0x12, 0x38, - 0x26, 0x20, 0x7d, 0x8d, 0x92, 0x9f, 0xb4, 0xf9, 0x74, 0x06, 0x32, 0x65, 0x89, 0x44, 0x8d, 0xf4, - 0x56, 0x01, 0x60, 0x25, 0x80, 0x9d, 0xb4, 0x9b, 0xbb, 0x01, 0xaa, 0x09, 0x2a, 0xcf, 0x40, 0x78, - 0x7e, 0xc8, 0xf1, 0xcd, 0x56, 0x15, 0xa1, 0x9e, 0x17, 0xb7, 0x3b, 0x11, 0x46, 0x98, 0x77, 0x65, - 0x5f, 0x65, 0x4f, 0x84, 0x18, 0x8d, 0x81, 0xfb, 0x49, 0xcc, 0x7d, 0x21, 0x50, 0xfb, 0x3a, 0x46, - 0x71, 0xc1, 0xa8, 0x41, 0x84, 0x20, 0x27, 0xb1, 0xd0, 0x3c, 0x90, 0x69, 0xa2, 0x91, 0x8f, 0x20, - 0x2d, 0x6e, 0x9d, 0x23, 0x42, 0x9f, 0x83, 0x7e, 0x59, 0x88, 0x0d, 0xc4, 0x5b, 0x74, 0x61, 0x4a, - 0x1f, 0x93, 0x1b, 0xa5, 0xbe, 0xe7, 0x87, 0xa1, 0x6c, 0x58, 0x77, 0xac, 0xf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x47, 0x6e, 0xb2, 0x33, 0x30, 0x73, 0xf7, 0x69, 0x97, 0x6f, 0x3e, 0x50, 0x2f, 0xc8, 0x00, 0x42, - 0x6f, 0x4c, 0x5f, 0x10, 0xf0, 0xd3, 0x2c, 0xde, 0x33, 0x7e, 0x5a, 0xa6, 0x7b, 0xd6, 0x3b, 0x3c, - 0x5f, 0xda, 0xd6, 0x62, 0x69, 0x5b, 0x3f, 0x96, 0xb6, 0xf5, 0x71, 0x65, 0xd7, 0x16, 0x2b, 0xbb, - 0xf6, 0x6d, 0x65, 0xd7, 0xde, 0x74, 0xa2, 0x58, 0x1f, 0xcf, 0x86, 0x2c, 0xc0, 0x09, 0x7f, 0x9a, - 0xcb, 0xbc, 0x00, 0xfd, 0x0e, 0xe5, 0xe8, 0x42, 0x75, 0xbe, 0xfe, 0x31, 0x74, 0x9a, 0x80, 0x1a, - 0x5e, 0x36, 0xef, 0xf8, 0xd1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x78, 0x5d, 0x1f, 0xfe, 0x8a, - 0x03, 0x00, 0x00, +// QueryOperatorConsAddressRequest is the request to obtain the consensus address of the operator +// for a specific chain ID. +type QueryOperatorConsAddressRequest struct { + // operator_acc_addr is the operator account address. + OperatorAccAddr string `protobuf:"bytes,1,opt,name=operator_acc_addr,json=operatorAccAddr,proto3" json:"operator_acc_addr,omitempty"` + // chain is the id of the chain served by the operator. here chain_id is not used since the + // Linter complains about capitalization, which can be set with a gogoproto.custom_name but + // that is not compatible with google.api.http.get in the Query service below. + Chain string `protobuf:"bytes,2,opt,name=chain,proto3" json:"chain,omitempty"` } -// 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 { - // OperatorInfo queries the operator information. - GetOperatorInfo(ctx context.Context, in *GetOperatorInfoReq, opts ...grpc.CallOption) (*OperatorInfo, error) - // QueryOperatorConsKeyForChainID queries the consensus public key for the operator - QueryOperatorConsKeyForChainID(ctx context.Context, in *QueryOperatorConsKeyRequest, opts ...grpc.CallOption) (*QueryOperatorConsKeyResponse, error) +func (m *QueryOperatorConsAddressRequest) Reset() { *m = QueryOperatorConsAddressRequest{} } +func (m *QueryOperatorConsAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorConsAddressRequest) ProtoMessage() {} +func (*QueryOperatorConsAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{5} } - -type queryClient struct { - cc grpc1.ClientConn +func (m *QueryOperatorConsAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} +func (m *QueryOperatorConsAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorConsAddressRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOperatorConsAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorConsAddressRequest.Merge(m, src) +} +func (m *QueryOperatorConsAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorConsAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorConsAddressRequest.DiscardUnknown(m) } -func (c *queryClient) GetOperatorInfo(ctx context.Context, in *GetOperatorInfoReq, opts ...grpc.CallOption) (*OperatorInfo, error) { - out := new(OperatorInfo) - err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/GetOperatorInfo", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryOperatorConsAddressRequest proto.InternalMessageInfo + +func (m *QueryOperatorConsAddressRequest) GetOperatorAccAddr() string { + if m != nil { + return m.OperatorAccAddr } - return out, nil + return "" } -func (c *queryClient) QueryOperatorConsKeyForChainID(ctx context.Context, in *QueryOperatorConsKeyRequest, opts ...grpc.CallOption) (*QueryOperatorConsKeyResponse, error) { - out := new(QueryOperatorConsKeyResponse) - err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryOperatorConsKeyForChainID", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryOperatorConsAddressRequest) GetChain() string { + if m != nil { + return m.Chain } - return out, nil + return "" } -// QueryServer is the server API for Query service. -type QueryServer interface { - // OperatorInfo queries the operator information. - GetOperatorInfo(context.Context, *GetOperatorInfoReq) (*OperatorInfo, error) - // QueryOperatorConsKeyForChainID queries the consensus public key for the operator - QueryOperatorConsKeyForChainID(context.Context, *QueryOperatorConsKeyRequest) (*QueryOperatorConsKeyResponse, error) +// QueryOperatorConsAddressResponse is the response for QueryOperatorConsAddressRequest. +type QueryOperatorConsAddressResponse struct { + // cons_addr is the consensus address corresponding to the consensus public key + // currently in use by the operator. + ConsAddr string `protobuf:"bytes,1,opt,name=cons_addr,json=consAddr,proto3" json:"cons_addr,omitempty"` + // opting_out is a flag to indicate if the operator is opting out of consensus. + OptingOut bool `protobuf:"varint,2,opt,name=opting_out,json=optingOut,proto3" json:"opting_out,omitempty"` } -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { +func (m *QueryOperatorConsAddressResponse) Reset() { *m = QueryOperatorConsAddressResponse{} } +func (m *QueryOperatorConsAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorConsAddressResponse) ProtoMessage() {} +func (*QueryOperatorConsAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{6} } - -func (*UnimplementedQueryServer) GetOperatorInfo(ctx context.Context, req *GetOperatorInfoReq) (*OperatorInfo, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetOperatorInfo not implemented") +func (m *QueryOperatorConsAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) QueryOperatorConsKeyForChainID(ctx context.Context, req *QueryOperatorConsKeyRequest) (*QueryOperatorConsKeyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryOperatorConsKeyForChainID not implemented") +func (m *QueryOperatorConsAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorConsAddressResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) +func (m *QueryOperatorConsAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorConsAddressResponse.Merge(m, src) +} +func (m *QueryOperatorConsAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorConsAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorConsAddressResponse.DiscardUnknown(m) } -func _Query_GetOperatorInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetOperatorInfoReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetOperatorInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/exocore.operator.v1.Query/GetOperatorInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetOperatorInfo(ctx, req.(*GetOperatorInfoReq)) +var xxx_messageInfo_QueryOperatorConsAddressResponse proto.InternalMessageInfo + +func (m *QueryOperatorConsAddressResponse) GetConsAddr() string { + if m != nil { + return m.ConsAddr } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_QueryOperatorConsKeyForChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOperatorConsKeyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryOperatorConsKeyForChainID(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/exocore.operator.v1.Query/QueryOperatorConsKeyForChainID", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryOperatorConsKeyForChainID(ctx, req.(*QueryOperatorConsKeyRequest)) +func (m *QueryOperatorConsAddressResponse) GetOptingOut() bool { + if m != nil { + return m.OptingOut } - return interceptor(ctx, in, info, handler) + return false } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "exocore.operator.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetOperatorInfo", - Handler: _Query_GetOperatorInfo_Handler, - }, - { - MethodName: "QueryOperatorConsKeyForChainID", - Handler: _Query_QueryOperatorConsKeyForChainID_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "exocore/operator/v1/query.proto", +// QueryAllOperatorConsKeysByChainIDRequest is the request to obtain all operator addresses +// and consensus keys for a specific chain ID, with pagination. +type QueryAllOperatorConsKeysByChainIDRequest struct { + // chain for which the cons keys are being queried. here chain_id is not used since the + // Linter complains about capitalization, which can be set with a gogoproto.custom_name but + // that is not compatible with google.api.http.get in the Query service below. + Chain string `protobuf:"bytes,1,opt,name=chain,proto3" json:"chain,omitempty"` + // pagination related options. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *GetOperatorInfoReq) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllOperatorConsKeysByChainIDRequest) Reset() { + *m = QueryAllOperatorConsKeysByChainIDRequest{} +} +func (m *QueryAllOperatorConsKeysByChainIDRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllOperatorConsKeysByChainIDRequest) ProtoMessage() {} +func (*QueryAllOperatorConsKeysByChainIDRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{7} +} +func (m *QueryAllOperatorConsKeysByChainIDRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOperatorConsKeysByChainIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOperatorConsKeysByChainIDRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return dAtA[:n], nil } - -func (m *GetOperatorInfoReq) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryAllOperatorConsKeysByChainIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOperatorConsKeysByChainIDRequest.Merge(m, src) +} +func (m *QueryAllOperatorConsKeysByChainIDRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOperatorConsKeysByChainIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOperatorConsKeysByChainIDRequest.DiscardUnknown(m) } -func (m *GetOperatorInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OperatorAddr) > 0 { - i -= len(m.OperatorAddr) - copy(dAtA[i:], m.OperatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddr))) - i-- - dAtA[i] = 0xa +var xxx_messageInfo_QueryAllOperatorConsKeysByChainIDRequest proto.InternalMessageInfo + +func (m *QueryAllOperatorConsKeysByChainIDRequest) GetChain() string { + if m != nil { + return m.Chain } - return len(dAtA) - i, nil + return "" } -func (m *QueryOperatorConsKeyRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllOperatorConsKeysByChainIDRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - return dAtA[:n], nil + return nil } -func (m *QueryOperatorConsKeyRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// QueryAllOperatorConsKeysByChainIDResponse is the response that includes a list of all operators +// and their consensus keys for a specified chain ID. +type QueryAllOperatorConsKeysByChainIDResponse struct { + // operator_cons_keys is a list of operator addresses and their consensus public keys. + OperatorConsKeys []*OperatorConsKeyPair `protobuf:"bytes,1,rep,name=operator_cons_keys,json=operatorConsKeys,proto3" json:"operator_cons_keys,omitempty"` + // pagination related response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryOperatorConsKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Addr) > 0 { - i -= len(m.Addr) - copy(dAtA[i:], m.Addr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Addr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +func (m *QueryAllOperatorConsKeysByChainIDResponse) Reset() { + *m = QueryAllOperatorConsKeysByChainIDResponse{} } - -func (m *QueryOperatorConsKeyResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllOperatorConsKeysByChainIDResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryAllOperatorConsKeysByChainIDResponse) ProtoMessage() {} +func (*QueryAllOperatorConsKeysByChainIDResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{8} +} +func (m *QueryAllOperatorConsKeysByChainIDResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOperatorConsKeysByChainIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOperatorConsKeysByChainIDResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return dAtA[:n], nil +} +func (m *QueryAllOperatorConsKeysByChainIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOperatorConsKeysByChainIDResponse.Merge(m, src) +} +func (m *QueryAllOperatorConsKeysByChainIDResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOperatorConsKeysByChainIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOperatorConsKeysByChainIDResponse.DiscardUnknown(m) } -func (m *QueryOperatorConsKeyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +var xxx_messageInfo_QueryAllOperatorConsKeysByChainIDResponse proto.InternalMessageInfo + +func (m *QueryAllOperatorConsKeysByChainIDResponse) GetOperatorConsKeys() []*OperatorConsKeyPair { + if m != nil { + return m.OperatorConsKeys + } + return nil } -func (m *QueryOperatorConsKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) +func (m *QueryAllOperatorConsKeysByChainIDResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// OperatorConsKeyPair holds the operator address and the consensus public key currently in +// use by the operator. +type OperatorConsKeyPair struct { + // operator_acc_addr is the operator account address. + OperatorAccAddr string `protobuf:"bytes,1,opt,name=operator_acc_addr,json=operatorAccAddr,proto3" json:"operator_acc_addr,omitempty"` + // public_key is the consensus public key of the operator. + PublicKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + // opting_out is a flag to indicate if the operator is opting out of consensus. + OptingOut bool `protobuf:"varint,3,opt,name=opting_out,json=optingOut,proto3" json:"opting_out,omitempty"` +} + +func (m *OperatorConsKeyPair) Reset() { *m = OperatorConsKeyPair{} } +func (m *OperatorConsKeyPair) String() string { return proto.CompactTextString(m) } +func (*OperatorConsKeyPair) ProtoMessage() {} +func (*OperatorConsKeyPair) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{9} +} +func (m *OperatorConsKeyPair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OperatorConsKeyPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OperatorConsKeyPair.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + return b[:n], nil } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil +} +func (m *OperatorConsKeyPair) XXX_Merge(src proto.Message) { + xxx_messageInfo_OperatorConsKeyPair.Merge(m, src) +} +func (m *OperatorConsKeyPair) XXX_Size() int { + return m.Size() +} +func (m *OperatorConsKeyPair) XXX_DiscardUnknown() { + xxx_messageInfo_OperatorConsKeyPair.DiscardUnknown(m) } -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++ +var xxx_messageInfo_OperatorConsKeyPair proto.InternalMessageInfo + +func (m *OperatorConsKeyPair) GetOperatorAccAddr() string { + if m != nil { + return m.OperatorAccAddr } - dAtA[offset] = uint8(v) - return base + return "" } -func (m *GetOperatorInfoReq) Size() (n int) { - if m == nil { - return 0 + +func (m *OperatorConsKeyPair) GetPublicKey() *crypto.PublicKey { + if m != nil { + return m.PublicKey } - var l int - _ = l - l = len(m.OperatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + return nil +} + +func (m *OperatorConsKeyPair) GetOptingOut() bool { + if m != nil { + return m.OptingOut } - return n + return false } -func (m *QueryOperatorConsKeyRequest) Size() (n int) { - if m == nil { - return 0 +// QueryAllOperatorConsAddrsByChainIDRequest is the request to obtain all operator addresses +// and consensus addresses for a specific chain ID, with pagination. +type QueryAllOperatorConsAddrsByChainIDRequest struct { + // chain for which the cons addrs are being queried. here chain_id is not used since the + // Linter complains about capitalization, which can be set with a gogoproto.custom_name but + // that is not compatible with google.api.http.get in the Query service below. + Chain string `protobuf:"bytes,1,opt,name=chain,proto3" json:"chain,omitempty"` + // pagination related options. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllOperatorConsAddrsByChainIDRequest) Reset() { + *m = QueryAllOperatorConsAddrsByChainIDRequest{} +} +func (m *QueryAllOperatorConsAddrsByChainIDRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryAllOperatorConsAddrsByChainIDRequest) ProtoMessage() {} +func (*QueryAllOperatorConsAddrsByChainIDRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{10} +} +func (m *QueryAllOperatorConsAddrsByChainIDRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOperatorConsAddrsByChainIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOperatorConsAddrsByChainIDRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - var l int - _ = l - l = len(m.Addr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +} +func (m *QueryAllOperatorConsAddrsByChainIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOperatorConsAddrsByChainIDRequest.Merge(m, src) +} +func (m *QueryAllOperatorConsAddrsByChainIDRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOperatorConsAddrsByChainIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOperatorConsAddrsByChainIDRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllOperatorConsAddrsByChainIDRequest proto.InternalMessageInfo + +func (m *QueryAllOperatorConsAddrsByChainIDRequest) GetChain() string { + if m != nil { + return m.Chain } - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + return "" +} + +func (m *QueryAllOperatorConsAddrsByChainIDRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAllOperatorConsAddrsByChainIDResponse is the response that includes a list of all operators +// and their consensus addresses for a specified chain ID. +type QueryAllOperatorConsAddrsByChainIDResponse struct { + // operator_cons_addrs is a list of operator account addresses and the consensus addresses. + OperatorConsAddrs []*OperatorConsAddrPair `protobuf:"bytes,1,rep,name=operator_cons_addrs,json=operatorConsAddrs,proto3" json:"operator_cons_addrs,omitempty"` + // pagination related response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllOperatorConsAddrsByChainIDResponse) Reset() { + *m = QueryAllOperatorConsAddrsByChainIDResponse{} +} +func (m *QueryAllOperatorConsAddrsByChainIDResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryAllOperatorConsAddrsByChainIDResponse) ProtoMessage() {} +func (*QueryAllOperatorConsAddrsByChainIDResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{11} +} +func (m *QueryAllOperatorConsAddrsByChainIDResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOperatorConsAddrsByChainIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOperatorConsAddrsByChainIDResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllOperatorConsAddrsByChainIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOperatorConsAddrsByChainIDResponse.Merge(m, src) +} +func (m *QueryAllOperatorConsAddrsByChainIDResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOperatorConsAddrsByChainIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOperatorConsAddrsByChainIDResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllOperatorConsAddrsByChainIDResponse proto.InternalMessageInfo + +func (m *QueryAllOperatorConsAddrsByChainIDResponse) GetOperatorConsAddrs() []*OperatorConsAddrPair { + if m != nil { + return m.OperatorConsAddrs + } + return nil +} + +func (m *QueryAllOperatorConsAddrsByChainIDResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// OperatorConsAddrPair holds the operator address and the corresponding consensus address. +type OperatorConsAddrPair struct { + // operator_acc_addr is the operator account address. + OperatorAccAddr string `protobuf:"bytes,1,opt,name=operator_acc_addr,json=operatorAccAddr,proto3" json:"operator_acc_addr,omitempty"` + // cons_addr is the consensus address corresponding to the consensus public key + // currently in use by the operator. + ConsAddr string `protobuf:"bytes,2,opt,name=cons_addr,json=consAddr,proto3" json:"cons_addr,omitempty"` + // opting_out is a flag to indicate if the operator is opting out of consensus. + OptingOut bool `protobuf:"varint,3,opt,name=opting_out,json=optingOut,proto3" json:"opting_out,omitempty"` +} + +func (m *OperatorConsAddrPair) Reset() { *m = OperatorConsAddrPair{} } +func (m *OperatorConsAddrPair) String() string { return proto.CompactTextString(m) } +func (*OperatorConsAddrPair) ProtoMessage() {} +func (*OperatorConsAddrPair) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{12} +} +func (m *OperatorConsAddrPair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OperatorConsAddrPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OperatorConsAddrPair.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OperatorConsAddrPair) XXX_Merge(src proto.Message) { + xxx_messageInfo_OperatorConsAddrPair.Merge(m, src) +} +func (m *OperatorConsAddrPair) XXX_Size() int { + return m.Size() +} +func (m *OperatorConsAddrPair) XXX_DiscardUnknown() { + xxx_messageInfo_OperatorConsAddrPair.DiscardUnknown(m) +} + +var xxx_messageInfo_OperatorConsAddrPair proto.InternalMessageInfo + +func (m *OperatorConsAddrPair) GetOperatorAccAddr() string { + if m != nil { + return m.OperatorAccAddr + } + return "" +} + +func (m *OperatorConsAddrPair) GetConsAddr() string { + if m != nil { + return m.ConsAddr + } + return "" +} + +func (m *OperatorConsAddrPair) GetOptingOut() bool { + if m != nil { + return m.OptingOut + } + return false +} + +func init() { + proto.RegisterType((*GetOperatorInfoReq)(nil), "exocore.operator.v1.GetOperatorInfoReq") + proto.RegisterType((*QueryAllOperatorsRequest)(nil), "exocore.operator.v1.QueryAllOperatorsRequest") + proto.RegisterType((*QueryAllOperatorsResponse)(nil), "exocore.operator.v1.QueryAllOperatorsResponse") + proto.RegisterType((*QueryOperatorConsKeyRequest)(nil), "exocore.operator.v1.QueryOperatorConsKeyRequest") + proto.RegisterType((*QueryOperatorConsKeyResponse)(nil), "exocore.operator.v1.QueryOperatorConsKeyResponse") + proto.RegisterType((*QueryOperatorConsAddressRequest)(nil), "exocore.operator.v1.QueryOperatorConsAddressRequest") + proto.RegisterType((*QueryOperatorConsAddressResponse)(nil), "exocore.operator.v1.QueryOperatorConsAddressResponse") + proto.RegisterType((*QueryAllOperatorConsKeysByChainIDRequest)(nil), "exocore.operator.v1.QueryAllOperatorConsKeysByChainIDRequest") + proto.RegisterType((*QueryAllOperatorConsKeysByChainIDResponse)(nil), "exocore.operator.v1.QueryAllOperatorConsKeysByChainIDResponse") + proto.RegisterType((*OperatorConsKeyPair)(nil), "exocore.operator.v1.OperatorConsKeyPair") + proto.RegisterType((*QueryAllOperatorConsAddrsByChainIDRequest)(nil), "exocore.operator.v1.QueryAllOperatorConsAddrsByChainIDRequest") + proto.RegisterType((*QueryAllOperatorConsAddrsByChainIDResponse)(nil), "exocore.operator.v1.QueryAllOperatorConsAddrsByChainIDResponse") + proto.RegisterType((*OperatorConsAddrPair)(nil), "exocore.operator.v1.OperatorConsAddrPair") +} + +func init() { proto.RegisterFile("exocore/operator/v1/query.proto", fileDescriptor_f91e795a3cecbdbf) } + +var fileDescriptor_f91e795a3cecbdbf = []byte{ + // 928 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x4f, 0xe3, 0x46, + 0x14, 0xce, 0x84, 0x52, 0x91, 0xa1, 0x55, 0xcb, 0x90, 0x43, 0x30, 0x34, 0x80, 0x55, 0x95, 0x10, + 0x15, 0xbb, 0x09, 0xd0, 0x43, 0x29, 0xad, 0x08, 0xbf, 0x44, 0xa9, 0x0a, 0x35, 0x52, 0xa5, 0xf6, + 0xd0, 0xc8, 0x71, 0x06, 0x63, 0x11, 0x3c, 0xc6, 0x9e, 0x50, 0x2c, 0x44, 0x55, 0xf5, 0xd4, 0xde, + 0xaa, 0xf6, 0x58, 0xb5, 0x7f, 0xc5, 0xfe, 0x07, 0x7b, 0xe1, 0xb0, 0x07, 0x76, 0xf7, 0xb2, 0x27, + 0x76, 0x45, 0xf6, 0x0f, 0x59, 0x79, 0x3c, 0x4e, 0xe2, 0xe0, 0x24, 0x0e, 0x42, 0x7b, 0x8b, 0xed, + 0x37, 0xef, 0x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5a, 0xad, 0x16, 0x64, 0x76, 0x14, 0x7c, + 0x5a, 0xc7, 0x0e, 0x45, 0x5b, 0x10, 0xb6, 0xea, 0xc1, 0xf2, 0x8e, 0x16, 0x3f, 0x91, 0x78, 0x52, + 0xaf, 0x78, 0x92, 0x5f, 0x6a, 0x5e, 0x3c, 0x69, 0x5f, 0xd5, 0x31, 0x3f, 0xab, 0xb4, 0x9d, 0x14, + 0xff, 0x06, 0x70, 0x22, 0x02, 0xc4, 0xb1, 0x88, 0xe9, 0x60, 0xf4, 0x29, 0x44, 0x2d, 0x01, 0x9a, + 0xc6, 0x44, 0x38, 0x19, 0x30, 0x33, 0x94, 0x4b, 0x29, 0x1f, 0x36, 0xb9, 0x6a, 0x9a, 0x47, 0xd7, + 0x41, 0xdb, 0x21, 0x4e, 0x49, 0xc6, 0x69, 0xae, 0x2f, 0x27, 0x1f, 0x2a, 0x44, 0xaa, 0x0c, 0x27, + 0x19, 0xa7, 0x80, 0xd0, 0x3a, 0x31, 0x9d, 0x5d, 0xec, 0x06, 0xda, 0xf3, 0x70, 0xec, 0x0e, 0x2b, + 0xbf, 0xb4, 0xca, 0x07, 0x1d, 0xa4, 0x50, 0x1a, 0x0e, 0x6b, 0x47, 0xaa, 0xe1, 0xd3, 0x49, 0x29, + 0xfe, 0x83, 0xf8, 0x1b, 0x80, 0x53, 0xd1, 0x08, 0x5c, 0xf8, 0x1a, 0x84, 0x56, 0xbd, 0x52, 0x33, + 0xb4, 0xf2, 0x31, 0x76, 0x79, 0x79, 0xa7, 0xa4, 0x96, 0x05, 0x24, 0xdf, 0x02, 0xd2, 0x3e, 0x0b, + 0xda, 0xc5, 0x6e, 0xe9, 0x9d, 0xab, 0x9b, 0xe9, 0x84, 0x92, 0xb2, 0x82, 0x17, 0xe8, 0x23, 0x08, + 0x89, 0x45, 0x0d, 0x53, 0x2f, 0x93, 0x3a, 0x65, 0xf0, 0x23, 0x4a, 0xca, 0x7f, 0xb3, 0x57, 0xa7, + 0xa2, 0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, 0x0b, 0x7b, 0x8e, 0x4c, + 0x14, 0x9f, 0x63, 0xe4, 0xdc, 0x17, 0xbe, 0xbe, 0xf7, 0x79, 0x2e, 0xf2, 0x4b, 0x26, 0xf2, 0x73, + 0xb4, 0x14, 0x53, 0x24, 0x1b, 0xe5, 0x81, 0xca, 0xd2, 0xb7, 0x57, 0xb7, 0x59, 0x70, 0x7d, 0x9b, + 0x05, 0xaf, 0x6e, 0xb3, 0xe0, 0xaf, 0x46, 0x36, 0x71, 0xdd, 0xc8, 0x26, 0x5e, 0x34, 0xb2, 0x89, + 0x9f, 0x8a, 0xba, 0x41, 0x8f, 0xea, 0x15, 0x49, 0x23, 0x27, 0xf2, 0xa6, 0x9f, 0xf9, 0x3b, 0x4c, + 0x7f, 0x21, 0xf6, 0x71, 0x13, 0xe8, 0xbc, 0x05, 0x45, 0x5d, 0x0b, 0x3b, 0x95, 0x77, 0xd9, 0x5f, + 0xfd, 0xc5, 0x37, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xfd, 0xf5, 0x2b, 0xd9, 0x0c, 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 { + // QueryOperatorInfo queries the operator information. + QueryOperatorInfo(ctx context.Context, in *GetOperatorInfoReq, opts ...grpc.CallOption) (*OperatorInfo, error) + // QueryAllOperators queries all operators. + QueryAllOperators(ctx context.Context, in *QueryAllOperatorsRequest, opts ...grpc.CallOption) (*QueryAllOperatorsResponse, error) + // QueryOperatorConsKeyForChainID queries the consensus public key for the operator + QueryOperatorConsKeyForChainID(ctx context.Context, in *QueryOperatorConsKeyRequest, opts ...grpc.CallOption) (*QueryOperatorConsKeyResponse, error) + // QueryOperatorConsAddressForChainID queries the consensus address for the operator. + QueryOperatorConsAddressForChainID(ctx context.Context, in *QueryOperatorConsAddressRequest, opts ...grpc.CallOption) (*QueryOperatorConsAddressResponse, error) + // QueryAllOperatorConsKeysByChainID queries all operators and their consensus public keys + // for a specific chain ID + QueryAllOperatorConsKeysByChainID(ctx context.Context, in *QueryAllOperatorConsKeysByChainIDRequest, opts ...grpc.CallOption) (*QueryAllOperatorConsKeysByChainIDResponse, error) + // QueryAllOperatorConsAddrsByChainID queries all operators and their consensus addresses + // for a specific chain ID + QueryAllOperatorConsAddrsByChainID(ctx context.Context, in *QueryAllOperatorConsAddrsByChainIDRequest, opts ...grpc.CallOption) (*QueryAllOperatorConsAddrsByChainIDResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) QueryOperatorInfo(ctx context.Context, in *GetOperatorInfoReq, opts ...grpc.CallOption) (*OperatorInfo, error) { + out := new(OperatorInfo) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryOperatorInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryAllOperators(ctx context.Context, in *QueryAllOperatorsRequest, opts ...grpc.CallOption) (*QueryAllOperatorsResponse, error) { + out := new(QueryAllOperatorsResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryAllOperators", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryOperatorConsKeyForChainID(ctx context.Context, in *QueryOperatorConsKeyRequest, opts ...grpc.CallOption) (*QueryOperatorConsKeyResponse, error) { + out := new(QueryOperatorConsKeyResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryOperatorConsKeyForChainID", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryOperatorConsAddressForChainID(ctx context.Context, in *QueryOperatorConsAddressRequest, opts ...grpc.CallOption) (*QueryOperatorConsAddressResponse, error) { + out := new(QueryOperatorConsAddressResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryOperatorConsAddressForChainID", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryAllOperatorConsKeysByChainID(ctx context.Context, in *QueryAllOperatorConsKeysByChainIDRequest, opts ...grpc.CallOption) (*QueryAllOperatorConsKeysByChainIDResponse, error) { + out := new(QueryAllOperatorConsKeysByChainIDResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryAllOperatorConsKeysByChainID", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryAllOperatorConsAddrsByChainID(ctx context.Context, in *QueryAllOperatorConsAddrsByChainIDRequest, opts ...grpc.CallOption) (*QueryAllOperatorConsAddrsByChainIDResponse, error) { + out := new(QueryAllOperatorConsAddrsByChainIDResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryAllOperatorConsAddrsByChainID", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // QueryOperatorInfo queries the operator information. + QueryOperatorInfo(context.Context, *GetOperatorInfoReq) (*OperatorInfo, error) + // QueryAllOperators queries all operators. + QueryAllOperators(context.Context, *QueryAllOperatorsRequest) (*QueryAllOperatorsResponse, error) + // QueryOperatorConsKeyForChainID queries the consensus public key for the operator + QueryOperatorConsKeyForChainID(context.Context, *QueryOperatorConsKeyRequest) (*QueryOperatorConsKeyResponse, error) + // QueryOperatorConsAddressForChainID queries the consensus address for the operator. + QueryOperatorConsAddressForChainID(context.Context, *QueryOperatorConsAddressRequest) (*QueryOperatorConsAddressResponse, error) + // QueryAllOperatorConsKeysByChainID queries all operators and their consensus public keys + // for a specific chain ID + QueryAllOperatorConsKeysByChainID(context.Context, *QueryAllOperatorConsKeysByChainIDRequest) (*QueryAllOperatorConsKeysByChainIDResponse, error) + // QueryAllOperatorConsAddrsByChainID queries all operators and their consensus addresses + // for a specific chain ID + QueryAllOperatorConsAddrsByChainID(context.Context, *QueryAllOperatorConsAddrsByChainIDRequest) (*QueryAllOperatorConsAddrsByChainIDResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) QueryOperatorInfo(ctx context.Context, req *GetOperatorInfoReq) (*OperatorInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryOperatorInfo not implemented") +} +func (*UnimplementedQueryServer) QueryAllOperators(ctx context.Context, req *QueryAllOperatorsRequest) (*QueryAllOperatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllOperators not implemented") +} +func (*UnimplementedQueryServer) QueryOperatorConsKeyForChainID(ctx context.Context, req *QueryOperatorConsKeyRequest) (*QueryOperatorConsKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryOperatorConsKeyForChainID not implemented") +} +func (*UnimplementedQueryServer) QueryOperatorConsAddressForChainID(ctx context.Context, req *QueryOperatorConsAddressRequest) (*QueryOperatorConsAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryOperatorConsAddressForChainID not implemented") +} +func (*UnimplementedQueryServer) QueryAllOperatorConsKeysByChainID(ctx context.Context, req *QueryAllOperatorConsKeysByChainIDRequest) (*QueryAllOperatorConsKeysByChainIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllOperatorConsKeysByChainID not implemented") +} +func (*UnimplementedQueryServer) QueryAllOperatorConsAddrsByChainID(ctx context.Context, req *QueryAllOperatorConsAddrsByChainIDRequest) (*QueryAllOperatorConsAddrsByChainIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllOperatorConsAddrsByChainID not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_QueryOperatorInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOperatorInfoReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryOperatorInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Query/QueryOperatorInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryOperatorInfo(ctx, req.(*GetOperatorInfoReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryAllOperators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllOperatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllOperators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Query/QueryAllOperators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllOperators(ctx, req.(*QueryAllOperatorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryOperatorConsKeyForChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOperatorConsKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryOperatorConsKeyForChainID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Query/QueryOperatorConsKeyForChainID", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryOperatorConsKeyForChainID(ctx, req.(*QueryOperatorConsKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryOperatorConsAddressForChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOperatorConsAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryOperatorConsAddressForChainID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Query/QueryOperatorConsAddressForChainID", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryOperatorConsAddressForChainID(ctx, req.(*QueryOperatorConsAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryAllOperatorConsKeysByChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllOperatorConsKeysByChainIDRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllOperatorConsKeysByChainID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Query/QueryAllOperatorConsKeysByChainID", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllOperatorConsKeysByChainID(ctx, req.(*QueryAllOperatorConsKeysByChainIDRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryAllOperatorConsAddrsByChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllOperatorConsAddrsByChainIDRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllOperatorConsAddrsByChainID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Query/QueryAllOperatorConsAddrsByChainID", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllOperatorConsAddrsByChainID(ctx, req.(*QueryAllOperatorConsAddrsByChainIDRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "exocore.operator.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "QueryOperatorInfo", + Handler: _Query_QueryOperatorInfo_Handler, + }, + { + MethodName: "QueryAllOperators", + Handler: _Query_QueryAllOperators_Handler, + }, + { + MethodName: "QueryOperatorConsKeyForChainID", + Handler: _Query_QueryOperatorConsKeyForChainID_Handler, + }, + { + MethodName: "QueryOperatorConsAddressForChainID", + Handler: _Query_QueryOperatorConsAddressForChainID_Handler, + }, + { + MethodName: "QueryAllOperatorConsKeysByChainID", + Handler: _Query_QueryAllOperatorConsKeysByChainID_Handler, + }, + { + MethodName: "QueryAllOperatorConsAddrsByChainID", + Handler: _Query_QueryAllOperatorConsAddrsByChainID_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "exocore/operator/v1/query.proto", +} + +func (m *GetOperatorInfoReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetOperatorInfoReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetOperatorInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorAddr) > 0 { + i -= len(m.OperatorAddr) + copy(dAtA[i:], m.OperatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllOperatorsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllOperatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOperatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllOperatorsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllOperatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOperatorsResponse) 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.OperatorAccAddrs) > 0 { + for iNdEx := len(m.OperatorAccAddrs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.OperatorAccAddrs[iNdEx]) + copy(dAtA[i:], m.OperatorAccAddrs[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAccAddrs[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorConsKeyRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOperatorConsKeyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorConsKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Chain) > 0 { + i -= len(m.Chain) + copy(dAtA[i:], m.Chain) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Chain))) + i-- + dAtA[i] = 0x12 + } + if len(m.OperatorAccAddr) > 0 { + i -= len(m.OperatorAccAddr) + copy(dAtA[i:], m.OperatorAccAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAccAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorConsKeyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOperatorConsKeyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorConsKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OptingOut { + i-- + if m.OptingOut { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + { + size, err := m.PublicKey.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 *QueryOperatorConsAddressRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOperatorConsAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorConsAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Chain) > 0 { + i -= len(m.Chain) + copy(dAtA[i:], m.Chain) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Chain))) + i-- + dAtA[i] = 0x12 + } + if len(m.OperatorAccAddr) > 0 { + i -= len(m.OperatorAccAddr) + copy(dAtA[i:], m.OperatorAccAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAccAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorConsAddressResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOperatorConsAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorConsAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OptingOut { + i-- + if m.OptingOut { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.ConsAddr) > 0 { + i -= len(m.ConsAddr) + copy(dAtA[i:], m.ConsAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllOperatorConsKeysByChainIDRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllOperatorConsKeysByChainIDRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOperatorConsKeysByChainIDRequest) 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.Chain) > 0 { + i -= len(m.Chain) + copy(dAtA[i:], m.Chain) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Chain))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllOperatorConsKeysByChainIDResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllOperatorConsKeysByChainIDResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOperatorConsKeysByChainIDResponse) 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.OperatorConsKeys) > 0 { + for iNdEx := len(m.OperatorConsKeys) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OperatorConsKeys[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 *OperatorConsKeyPair) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperatorConsKeyPair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OperatorConsKeyPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OptingOut { + i-- + if m.OptingOut { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.PublicKey != nil { + { + size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.OperatorAccAddr) > 0 { + i -= len(m.OperatorAccAddr) + copy(dAtA[i:], m.OperatorAccAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAccAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllOperatorConsAddrsByChainIDRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllOperatorConsAddrsByChainIDRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOperatorConsAddrsByChainIDRequest) 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.Chain) > 0 { + i -= len(m.Chain) + copy(dAtA[i:], m.Chain) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Chain))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllOperatorConsAddrsByChainIDResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllOperatorConsAddrsByChainIDResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOperatorConsAddrsByChainIDResponse) 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.OperatorConsAddrs) > 0 { + for iNdEx := len(m.OperatorConsAddrs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OperatorConsAddrs[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 *OperatorConsAddrPair) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperatorConsAddrPair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OperatorConsAddrPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OptingOut { + i-- + if m.OptingOut { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.ConsAddr) > 0 { + i -= len(m.ConsAddr) + copy(dAtA[i:], m.ConsAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.OperatorAccAddr) > 0 { + i -= len(m.OperatorAccAddr) + copy(dAtA[i:], m.OperatorAccAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAccAddr))) + 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 *GetOperatorInfoReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllOperatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllOperatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OperatorAccAddrs) > 0 { + for _, s := range m.OperatorAccAddrs { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOperatorConsKeyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAccAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Chain) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOperatorConsKeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.PublicKey.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.OptingOut { + n += 2 + } + return n +} + +func (m *QueryOperatorConsAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAccAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Chain) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOperatorConsAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.OptingOut { + n += 2 + } + return n +} + +func (m *QueryAllOperatorConsKeysByChainIDRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Chain) + 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 *QueryAllOperatorConsKeysByChainIDResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OperatorConsKeys) > 0 { + for _, e := range m.OperatorConsKeys { + 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 *OperatorConsKeyPair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAccAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.PublicKey != nil { + l = m.PublicKey.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.OptingOut { + n += 2 + } + return n +} + +func (m *QueryAllOperatorConsAddrsByChainIDRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Chain) + 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 *QueryAllOperatorConsAddrsByChainIDResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OperatorConsAddrs) > 0 { + for _, e := range m.OperatorConsAddrs { + 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 *OperatorConsAddrPair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAccAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ConsAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.OptingOut { + n += 2 + } + 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 *GetOperatorInfoReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetOperatorInfoReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetOperatorInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddr", 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.OperatorAddr = 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 *QueryAllOperatorsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllOperatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllOperatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllOperatorsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllOperatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllOperatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAccAddrs", 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.OperatorAccAddrs = append(m.OperatorAccAddrs, 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.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 *QueryOperatorConsKeyRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOperatorConsKeyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorConsKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAccAddr", 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.OperatorAccAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chain", 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.Chain = 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 *QueryOperatorConsKeyResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOperatorConsKeyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorConsKeyResponse: 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 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.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptingOut", 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.OptingOut = bool(v != 0) + 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 *QueryOperatorConsAddressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOperatorConsAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorConsAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAccAddr", 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.OperatorAccAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chain", 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.Chain = 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 *QueryOperatorConsAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOperatorConsAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorConsAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsAddr", 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.ConsAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptingOut", 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.OptingOut = bool(v != 0) + 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 *QueryAllOperatorConsKeysByChainIDRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllOperatorConsKeysByChainIDRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllOperatorConsKeysByChainIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chain", 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.Chain = 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 *QueryAllOperatorConsKeysByChainIDResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllOperatorConsKeysByChainIDResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllOperatorConsKeysByChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorConsKeys", 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.OperatorConsKeys = append(m.OperatorConsKeys, &OperatorConsKeyPair{}) + if err := m.OperatorConsKeys[len(m.OperatorConsKeys)-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 + } } - return n -} -func (m *QueryOperatorConsKeyResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = m.PublicKey.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)))) + return nil } -func (m *GetOperatorInfoReq) Unmarshal(dAtA []byte) error { +func (m *OperatorConsKeyPair) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -522,15 +2898,15 @@ func (m *GetOperatorInfoReq) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetOperatorInfoReq: wiretype end group for non-group") + return fmt.Errorf("proto: OperatorConsKeyPair: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetOperatorInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OperatorConsKeyPair: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAccAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -558,8 +2934,64 @@ func (m *GetOperatorInfoReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddr = string(dAtA[iNdEx:postIndex]) + m.OperatorAccAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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.PublicKey == nil { + m.PublicKey = &crypto.PublicKey{} + } + if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptingOut", 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.OptingOut = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -581,7 +3013,7 @@ func (m *GetOperatorInfoReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryOperatorConsKeyRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllOperatorConsAddrsByChainIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -604,15 +3036,15 @@ func (m *QueryOperatorConsKeyRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryOperatorConsKeyRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllOperatorConsAddrsByChainIDRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOperatorConsKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllOperatorConsAddrsByChainIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -640,13 +3072,13 @@ func (m *QueryOperatorConsKeyRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Addr = string(dAtA[iNdEx:postIndex]) + m.Chain = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -656,23 +3088,27 @@ func (m *QueryOperatorConsKeyRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + 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 @@ -695,7 +3131,7 @@ func (m *QueryOperatorConsKeyRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryOperatorConsKeyResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllOperatorConsAddrsByChainIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -718,15 +3154,15 @@ func (m *QueryOperatorConsKeyResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryOperatorConsKeyResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllOperatorConsAddrsByChainIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOperatorConsKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllOperatorConsAddrsByChainIDResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field OperatorConsAddrs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -753,10 +3189,181 @@ func (m *QueryOperatorConsKeyResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.OperatorConsAddrs = append(m.OperatorConsAddrs, &OperatorConsAddrPair{}) + if err := m.OperatorConsAddrs[len(m.OperatorConsAddrs)-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 *OperatorConsAddrPair) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OperatorConsAddrPair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OperatorConsAddrPair: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAccAddr", 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.OperatorAccAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsAddr", 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.ConsAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OptingOut", 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.OptingOut = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/operator/types/query.pb.gw.go b/x/operator/types/query.pb.gw.go index 145ebcd2e..e4ce40c91 100644 --- a/x/operator/types/query.pb.gw.go +++ b/x/operator/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,39 +31,94 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_QueryOperatorInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetOperatorInfoReq + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_addr") + } + + protoReq.OperatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_addr", err) + } + + msg, err := client.QueryOperatorInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryOperatorInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetOperatorInfoReq + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_addr") + } + + protoReq.OperatorAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_addr", err) + } + + msg, err := server.QueryOperatorInfo(ctx, &protoReq) + return msg, metadata, err + +} var ( - filter_Query_GetOperatorInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_QueryAllOperators_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_GetOperatorInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOperatorInfoReq +func request_Query_QueryAllOperators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOperatorsRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetOperatorInfo_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllOperators_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetOperatorInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.QueryAllOperators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetOperatorInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetOperatorInfoReq +func local_request_Query_QueryAllOperators_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOperatorsRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetOperatorInfo_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllOperators_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetOperatorInfo(ctx, &protoReq) + msg, err := server.QueryAllOperators(ctx, &protoReq) return msg, metadata, err } @@ -78,26 +134,26 @@ func request_Query_QueryOperatorConsKeyForChainID_0(ctx context.Context, marshal _ = err ) - val, ok = pathParams["addr"] + val, ok = pathParams["operator_acc_addr"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "addr") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_acc_addr") } - protoReq.Addr, err = runtime.String(val) + protoReq.OperatorAccAddr, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "addr", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_acc_addr", err) } - val, ok = pathParams["chain_id"] + val, ok = pathParams["chain"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain") } - protoReq.ChainId, err = runtime.String(val) + protoReq.Chain, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err) } msg, err := client.QueryOperatorConsKeyForChainID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -116,26 +172,26 @@ func local_request_Query_QueryOperatorConsKeyForChainID_0(ctx context.Context, m _ = err ) - val, ok = pathParams["addr"] + val, ok = pathParams["operator_acc_addr"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "addr") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_acc_addr") } - protoReq.Addr, err = runtime.String(val) + protoReq.OperatorAccAddr, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "addr", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_acc_addr", err) } - val, ok = pathParams["chain_id"] + val, ok = pathParams["chain"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain") } - protoReq.ChainId, err = runtime.String(val) + protoReq.Chain, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err) } msg, err := server.QueryOperatorConsKeyForChainID(ctx, &protoReq) @@ -143,35 +199,283 @@ func local_request_Query_QueryOperatorConsKeyForChainID_0(ctx context.Context, m } +func request_Query_QueryOperatorConsAddressForChainID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorConsAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_acc_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_acc_addr") + } + + protoReq.OperatorAccAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_acc_addr", err) + } + + val, ok = pathParams["chain"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain") + } + + protoReq.Chain, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err) + } + + msg, err := client.QueryOperatorConsAddressForChainID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryOperatorConsAddressForChainID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorConsAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_acc_addr"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_acc_addr") + } + + protoReq.OperatorAccAddr, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_acc_addr", err) + } + + val, ok = pathParams["chain"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain") + } + + protoReq.Chain, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err) + } + + msg, err := server.QueryOperatorConsAddressForChainID(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QueryAllOperatorConsKeysByChainID_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_QueryAllOperatorConsKeysByChainID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOperatorConsKeysByChainIDRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain") + } + + protoReq.Chain, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllOperatorConsKeysByChainID_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryAllOperatorConsKeysByChainID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllOperatorConsKeysByChainID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOperatorConsKeysByChainIDRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain") + } + + protoReq.Chain, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllOperatorConsKeysByChainID_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryAllOperatorConsKeysByChainID(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QueryAllOperatorConsAddrsByChainID_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_QueryAllOperatorConsAddrsByChainID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOperatorConsAddrsByChainIDRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain") + } + + protoReq.Chain, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllOperatorConsAddrsByChainID_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryAllOperatorConsAddrsByChainID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllOperatorConsAddrsByChainID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOperatorConsAddrsByChainIDRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain") + } + + protoReq.Chain, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAllOperatorConsAddrsByChainID_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryAllOperatorConsAddrsByChainID(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_GetOperatorInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryOperatorInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryOperatorInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryOperatorInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllOperators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_GetOperatorInfo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryAllOperators_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_GetOperatorInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryAllOperators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle("GET", pattern_Query_QueryOperatorConsKeyForChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -179,6 +483,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueryOperatorConsKeyForChainID_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -189,6 +494,75 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryOperatorConsAddressForChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryOperatorConsAddressForChainID_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryOperatorConsAddressForChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllOperatorConsKeysByChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryAllOperatorConsKeysByChainID_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllOperatorConsKeysByChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllOperatorConsAddrsByChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryAllOperatorConsAddrsByChainID_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllOperatorConsAddrsByChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -230,7 +604,27 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_GetOperatorInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryOperatorInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryOperatorInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryOperatorInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllOperators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -239,14 +633,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetOperatorInfo_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryAllOperators_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_GetOperatorInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryAllOperators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -270,17 +664,93 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryOperatorConsAddressForChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryOperatorConsAddressForChainID_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryOperatorConsAddressForChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllOperatorConsKeysByChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryAllOperatorConsKeysByChainID_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllOperatorConsKeysByChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllOperatorConsAddrsByChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryAllOperatorConsAddrsByChainID_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllOperatorConsAddrsByChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( - pattern_Query_GetOperatorInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "delegation", "v1", "GetOperatorInfo"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryOperatorInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "operator", "v1", "operator_info", "operator_addr"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllOperators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "operator", "v1", "all_operators"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryOperatorConsKeyForChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"exocore", "operator", "v1", "operator_cons_key", "operator_acc_addr", "chain"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryOperatorConsAddressForChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"exocore", "operator", "v1", "operator_cons_addr", "operator_acc_addr", "chain"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryOperatorConsKeyForChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"exocore", "operator_consent", "v1", "GetOperatorConsKey", "addr", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryAllOperatorConsKeysByChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "operator", "v1", "all_operator_cons_keys", "chain"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllOperatorConsAddrsByChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "operator", "v1", "all_operator_cons_addrs", "chain"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_GetOperatorInfo_0 = runtime.ForwardResponseMessage + forward_Query_QueryOperatorInfo_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllOperators_0 = runtime.ForwardResponseMessage forward_Query_QueryOperatorConsKeyForChainID_0 = runtime.ForwardResponseMessage + + forward_Query_QueryOperatorConsAddressForChainID_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllOperatorConsKeysByChainID_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllOperatorConsAddrsByChainID_0 = runtime.ForwardResponseMessage ) diff --git a/x/operator/types/tx.pb.go b/x/operator/types/tx.pb.go index 2b6add2f1..97c8639b1 100644 --- a/x/operator/types/tx.pb.go +++ b/x/operator/types/tx.pb.go @@ -219,7 +219,8 @@ type OperatorInfo struct { OperatorMetaInfo string `protobuf:"bytes,3,opt,name=operator_meta_info,json=operatorMetaInfo,proto3" json:"operator_meta_info,omitempty"` // client_chain_earning_addr_list is the client chain earning address list. ClientChainEarningsAddr *ClientChainEarningAddrList `protobuf:"bytes,4,opt,name=client_chain_earnings_addr,json=clientChainEarningsAddr,proto3" json:"client_chain_earnings_addr,omitempty"` - // commission defines the commission parameters. + // commission defines the commission parameters. it includes the time at which the commission + // was last updated. Commission types.Commission `protobuf:"bytes,5,opt,name=commission,proto3" json:"commission"` } @@ -576,31 +577,29 @@ func (m *RegisterOperatorResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterOperatorResponse proto.InternalMessageInfo -// OptInToCosmosChainRequest defines the OptInToCosmosChain request. -type OptInToCosmosChainRequest struct { - // address is the operator address - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // chain_id is the identifier for the chain that wants to opt in. - ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` - // there is no need to check for knowledge of the corresponding private key since this is ED25519 - // and not BLS key, where a rogue key attack can take place. however, we should still check for - // overlap with another operator's key. +// OptIntoAVSReq is the request to opt into an AVS. +type OptIntoAVSReq struct { + // from_address is the address of the operator (sdk.AccAddress). + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // avs_address is the address of the AVS - either an 0x address or a chainID. + AvsAddress string `protobuf:"bytes,2,opt,name=avs_address,json=avsAddress,proto3" json:"avs_address,omitempty"` + // optional parameter to provide the consensus key or the BLS key, depending + // on the AVS. we still have to design this fully. PublicKey string `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` } -func (m *OptInToCosmosChainRequest) Reset() { *m = OptInToCosmosChainRequest{} } -func (m *OptInToCosmosChainRequest) String() string { return proto.CompactTextString(m) } -func (*OptInToCosmosChainRequest) ProtoMessage() {} -func (*OptInToCosmosChainRequest) Descriptor() ([]byte, []int) { +func (m *OptIntoAVSReq) Reset() { *m = OptIntoAVSReq{} } +func (m *OptIntoAVSReq) String() string { return proto.CompactTextString(m) } +func (*OptIntoAVSReq) ProtoMessage() {} +func (*OptIntoAVSReq) Descriptor() ([]byte, []int) { return fileDescriptor_b229d5663e4df167, []int{9} } -func (m *OptInToCosmosChainRequest) XXX_Unmarshal(b []byte) error { +func (m *OptIntoAVSReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *OptInToCosmosChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *OptIntoAVSReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_OptInToCosmosChainRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_OptIntoAVSReq.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -610,55 +609,75 @@ func (m *OptInToCosmosChainRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *OptInToCosmosChainRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_OptInToCosmosChainRequest.Merge(m, src) +func (m *OptIntoAVSReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_OptIntoAVSReq.Merge(m, src) } -func (m *OptInToCosmosChainRequest) XXX_Size() int { +func (m *OptIntoAVSReq) XXX_Size() int { return m.Size() } -func (m *OptInToCosmosChainRequest) XXX_DiscardUnknown() { - xxx_messageInfo_OptInToCosmosChainRequest.DiscardUnknown(m) +func (m *OptIntoAVSReq) XXX_DiscardUnknown() { + xxx_messageInfo_OptIntoAVSReq.DiscardUnknown(m) } -var xxx_messageInfo_OptInToCosmosChainRequest proto.InternalMessageInfo +var xxx_messageInfo_OptIntoAVSReq proto.InternalMessageInfo -func (m *OptInToCosmosChainRequest) GetAddress() string { - if m != nil { - return m.Address - } - return "" +// OptIntoAVSResponse is the response to a opt into an AVS request. +type OptIntoAVSResponse struct { } -func (m *OptInToCosmosChainRequest) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" +func (m *OptIntoAVSResponse) Reset() { *m = OptIntoAVSResponse{} } +func (m *OptIntoAVSResponse) String() string { return proto.CompactTextString(m) } +func (*OptIntoAVSResponse) ProtoMessage() {} +func (*OptIntoAVSResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b229d5663e4df167, []int{10} } - -func (m *OptInToCosmosChainRequest) GetPublicKey() string { - if m != nil { - return m.PublicKey +func (m *OptIntoAVSResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OptIntoAVSResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OptIntoAVSResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return "" +} +func (m *OptIntoAVSResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_OptIntoAVSResponse.Merge(m, src) +} +func (m *OptIntoAVSResponse) XXX_Size() int { + return m.Size() +} +func (m *OptIntoAVSResponse) XXX_DiscardUnknown() { + xxx_messageInfo_OptIntoAVSResponse.DiscardUnknown(m) } -// OptInToCosmosChainResponse defines the OptInToCosmosChain response. -type OptInToCosmosChainResponse struct { +var xxx_messageInfo_OptIntoAVSResponse proto.InternalMessageInfo + +// OptOutOfAVSReq is the request to opt out from an AVS. +type OptOutOfAVSReq struct { + // from_address is the address of the operator (sdk.AccAddress). + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // avs_address is the address of the AVS - either an 0x address or a chainID. + AvsAddress string `protobuf:"bytes,2,opt,name=avs_address,json=avsAddress,proto3" json:"avs_address,omitempty"` } -func (m *OptInToCosmosChainResponse) Reset() { *m = OptInToCosmosChainResponse{} } -func (m *OptInToCosmosChainResponse) String() string { return proto.CompactTextString(m) } -func (*OptInToCosmosChainResponse) ProtoMessage() {} -func (*OptInToCosmosChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{10} +func (m *OptOutOfAVSReq) Reset() { *m = OptOutOfAVSReq{} } +func (m *OptOutOfAVSReq) String() string { return proto.CompactTextString(m) } +func (*OptOutOfAVSReq) ProtoMessage() {} +func (*OptOutOfAVSReq) Descriptor() ([]byte, []int) { + return fileDescriptor_b229d5663e4df167, []int{11} } -func (m *OptInToCosmosChainResponse) XXX_Unmarshal(b []byte) error { +func (m *OptOutOfAVSReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *OptInToCosmosChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *OptOutOfAVSReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_OptInToCosmosChainResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_OptOutOfAVSReq.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -668,38 +687,34 @@ func (m *OptInToCosmosChainResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *OptInToCosmosChainResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_OptInToCosmosChainResponse.Merge(m, src) +func (m *OptOutOfAVSReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_OptOutOfAVSReq.Merge(m, src) } -func (m *OptInToCosmosChainResponse) XXX_Size() int { +func (m *OptOutOfAVSReq) XXX_Size() int { return m.Size() } -func (m *OptInToCosmosChainResponse) XXX_DiscardUnknown() { - xxx_messageInfo_OptInToCosmosChainResponse.DiscardUnknown(m) +func (m *OptOutOfAVSReq) XXX_DiscardUnknown() { + xxx_messageInfo_OptOutOfAVSReq.DiscardUnknown(m) } -var xxx_messageInfo_OptInToCosmosChainResponse proto.InternalMessageInfo +var xxx_messageInfo_OptOutOfAVSReq proto.InternalMessageInfo -// InitOptOutFromCosmosChainRequest defines the InitOptOutFromCosmosChain request. -type InitOptOutFromCosmosChainRequest struct { - // address is the operator address - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // chain_id is the identifier for the chain that wants to opt out. - ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +// OptOutOfAVSResponse is the response to a opt out of an AVS request. +type OptOutOfAVSResponse struct { } -func (m *InitOptOutFromCosmosChainRequest) Reset() { *m = InitOptOutFromCosmosChainRequest{} } -func (m *InitOptOutFromCosmosChainRequest) String() string { return proto.CompactTextString(m) } -func (*InitOptOutFromCosmosChainRequest) ProtoMessage() {} -func (*InitOptOutFromCosmosChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{11} +func (m *OptOutOfAVSResponse) Reset() { *m = OptOutOfAVSResponse{} } +func (m *OptOutOfAVSResponse) String() string { return proto.CompactTextString(m) } +func (*OptOutOfAVSResponse) ProtoMessage() {} +func (*OptOutOfAVSResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b229d5663e4df167, []int{12} } -func (m *InitOptOutFromCosmosChainRequest) XXX_Unmarshal(b []byte) error { +func (m *OptOutOfAVSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *InitOptOutFromCosmosChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *OptOutOfAVSResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_InitOptOutFromCosmosChainRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_OptOutOfAVSResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -709,48 +724,80 @@ func (m *InitOptOutFromCosmosChainRequest) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *InitOptOutFromCosmosChainRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitOptOutFromCosmosChainRequest.Merge(m, src) +func (m *OptOutOfAVSResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_OptOutOfAVSResponse.Merge(m, src) } -func (m *InitOptOutFromCosmosChainRequest) XXX_Size() int { +func (m *OptOutOfAVSResponse) XXX_Size() int { return m.Size() } -func (m *InitOptOutFromCosmosChainRequest) XXX_DiscardUnknown() { - xxx_messageInfo_InitOptOutFromCosmosChainRequest.DiscardUnknown(m) +func (m *OptOutOfAVSResponse) XXX_DiscardUnknown() { + xxx_messageInfo_OptOutOfAVSResponse.DiscardUnknown(m) } -var xxx_messageInfo_InitOptOutFromCosmosChainRequest proto.InternalMessageInfo +var xxx_messageInfo_OptOutOfAVSResponse proto.InternalMessageInfo -func (m *InitOptOutFromCosmosChainRequest) GetAddress() string { - if m != nil { - return m.Address - } - return "" +// SetConsKeyReq is the request to set the operator's consensus key for a chain. +type SetConsKeyReq struct { + // address is the operator address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // chain_id is the identifier for the chain that wants to opt in. + ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` + // there is no need to check for knowledge of the corresponding private key since this is ED25519 + // and not BLS key, where a rogue key attack can take place. however, we should still check for + // overlap with another operator's key. + PublicKey string `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` } -func (m *InitOptOutFromCosmosChainRequest) GetChainId() string { - if m != nil { - return m.ChainId +func (m *SetConsKeyReq) Reset() { *m = SetConsKeyReq{} } +func (m *SetConsKeyReq) String() string { return proto.CompactTextString(m) } +func (*SetConsKeyReq) ProtoMessage() {} +func (*SetConsKeyReq) Descriptor() ([]byte, []int) { + return fileDescriptor_b229d5663e4df167, []int{13} +} +func (m *SetConsKeyReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetConsKeyReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SetConsKeyReq.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return "" } +func (m *SetConsKeyReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetConsKeyReq.Merge(m, src) +} +func (m *SetConsKeyReq) XXX_Size() int { + return m.Size() +} +func (m *SetConsKeyReq) XXX_DiscardUnknown() { + xxx_messageInfo_SetConsKeyReq.DiscardUnknown(m) +} + +var xxx_messageInfo_SetConsKeyReq proto.InternalMessageInfo -// InitOptOutFromCosmosChainResponse defines the InitOptOutFromCosmosChain response. -type InitOptOutFromCosmosChainResponse struct { +// SetConsKeyResponse is the response to SetConsKeyReq. +type SetConsKeyResponse struct { } -func (m *InitOptOutFromCosmosChainResponse) Reset() { *m = InitOptOutFromCosmosChainResponse{} } -func (m *InitOptOutFromCosmosChainResponse) String() string { return proto.CompactTextString(m) } -func (*InitOptOutFromCosmosChainResponse) ProtoMessage() {} -func (*InitOptOutFromCosmosChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{12} +func (m *SetConsKeyResponse) Reset() { *m = SetConsKeyResponse{} } +func (m *SetConsKeyResponse) String() string { return proto.CompactTextString(m) } +func (*SetConsKeyResponse) ProtoMessage() {} +func (*SetConsKeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b229d5663e4df167, []int{14} } -func (m *InitOptOutFromCosmosChainResponse) XXX_Unmarshal(b []byte) error { +func (m *SetConsKeyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *InitOptOutFromCosmosChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *SetConsKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_InitOptOutFromCosmosChainResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_SetConsKeyResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -760,17 +807,17 @@ func (m *InitOptOutFromCosmosChainResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *InitOptOutFromCosmosChainResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitOptOutFromCosmosChainResponse.Merge(m, src) +func (m *SetConsKeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetConsKeyResponse.Merge(m, src) } -func (m *InitOptOutFromCosmosChainResponse) XXX_Size() int { +func (m *SetConsKeyResponse) XXX_Size() int { return m.Size() } -func (m *InitOptOutFromCosmosChainResponse) XXX_DiscardUnknown() { - xxx_messageInfo_InitOptOutFromCosmosChainResponse.DiscardUnknown(m) +func (m *SetConsKeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SetConsKeyResponse.DiscardUnknown(m) } -var xxx_messageInfo_InitOptOutFromCosmosChainResponse proto.InternalMessageInfo +var xxx_messageInfo_SetConsKeyResponse proto.InternalMessageInfo func init() { proto.RegisterEnum("exocore.operator.v1.SlashType", SlashType_name, SlashType_value) @@ -783,88 +830,94 @@ func init() { proto.RegisterType((*OperatorSlashInfo)(nil), "exocore.operator.v1.OperatorSlashInfo") proto.RegisterType((*RegisterOperatorReq)(nil), "exocore.operator.v1.RegisterOperatorReq") proto.RegisterType((*RegisterOperatorResponse)(nil), "exocore.operator.v1.RegisterOperatorResponse") - proto.RegisterType((*OptInToCosmosChainRequest)(nil), "exocore.operator.v1.OptInToCosmosChainRequest") - proto.RegisterType((*OptInToCosmosChainResponse)(nil), "exocore.operator.v1.OptInToCosmosChainResponse") - proto.RegisterType((*InitOptOutFromCosmosChainRequest)(nil), "exocore.operator.v1.InitOptOutFromCosmosChainRequest") - proto.RegisterType((*InitOptOutFromCosmosChainResponse)(nil), "exocore.operator.v1.InitOptOutFromCosmosChainResponse") + proto.RegisterType((*OptIntoAVSReq)(nil), "exocore.operator.v1.OptIntoAVSReq") + proto.RegisterType((*OptIntoAVSResponse)(nil), "exocore.operator.v1.OptIntoAVSResponse") + proto.RegisterType((*OptOutOfAVSReq)(nil), "exocore.operator.v1.OptOutOfAVSReq") + proto.RegisterType((*OptOutOfAVSResponse)(nil), "exocore.operator.v1.OptOutOfAVSResponse") + proto.RegisterType((*SetConsKeyReq)(nil), "exocore.operator.v1.SetConsKeyReq") + proto.RegisterType((*SetConsKeyResponse)(nil), "exocore.operator.v1.SetConsKeyResponse") } func init() { proto.RegisterFile("exocore/operator/v1/tx.proto", fileDescriptor_b229d5663e4df167) } var fileDescriptor_b229d5663e4df167 = []byte{ - // 1139 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x4f, 0x1b, 0x47, - 0x14, 0xf6, 0x62, 0x7e, 0xf9, 0x61, 0xb0, 0x19, 0x22, 0x30, 0x2e, 0x35, 0xb0, 0x69, 0x22, 0x82, - 0x8a, 0x2d, 0x68, 0x53, 0xa9, 0x69, 0x2b, 0xd5, 0x18, 0xa3, 0x58, 0x05, 0x1b, 0xad, 0x9d, 0x48, - 0x6d, 0x0f, 0xab, 0x65, 0x3d, 0x98, 0x29, 0xf6, 0xce, 0x66, 0x67, 0xec, 0x40, 0xa4, 0x4a, 0x6d, - 0x4f, 0x55, 0xd5, 0x43, 0xaf, 0x95, 0x7a, 0xc8, 0xb1, 0x47, 0x0e, 0xb9, 0x56, 0x55, 0x6f, 0x39, - 0x46, 0x39, 0x55, 0x3d, 0xa0, 0x0a, 0x0e, 0xf4, 0x4f, 0xe8, 0xb1, 0x9a, 0xd9, 0x59, 0xb3, 0x04, - 0xd3, 0x04, 0x25, 0x97, 0xc4, 0xf3, 0xde, 0xf7, 0x7e, 0x7d, 0xf3, 0xcd, 0x63, 0x61, 0x06, 0xef, - 0x53, 0x9b, 0x7a, 0x38, 0x47, 0x5d, 0xec, 0x59, 0x9c, 0x7a, 0xb9, 0xce, 0x72, 0x8e, 0xef, 0x67, - 0x5d, 0x8f, 0x72, 0x8a, 0x26, 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0x57, 0xb7, 0x1c, 0x41, 0x3f, 0x6a, 0x30, 0x7d, 0xe9, 0x0d, 0xa0, 0xdb, 0x3d, 0x13, 0xbe, - 0x4c, 0x18, 0xe9, 0x0f, 0xae, 0x1a, 0x16, 0xb4, 0x93, 0x1e, 0xf8, 0x46, 0xfc, 0x79, 0x5b, 0xdd, - 0x78, 0x7a, 0x9c, 0xd1, 0x9e, 0x1d, 0x67, 0xb4, 0xbf, 0x8f, 0x33, 0xda, 0x4f, 0x27, 0x99, 0xc8, - 0xb3, 0x93, 0x4c, 0xe4, 0xcf, 0x93, 0x4c, 0xe4, 0x8b, 0x95, 0xd0, 0x62, 0x2a, 0xfa, 0x45, 0xca, - 0x98, 0x3f, 0xa4, 0xde, 0x5e, 0x2e, 0xf8, 0xfc, 0xdc, 0x3f, 0xfb, 0x00, 0x95, 0x8b, 0x6a, 0x7b, - 0x50, 0x7e, 0xe9, 0xbd, 0xf7, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x8a, 0x43, 0x4e, 0xa1, - 0x0a, 0x00, 0x00, + // 1212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xc6, 0x69, 0x12, 0x3f, 0xc7, 0xb1, 0x3b, 0x29, 0xad, 0x6b, 0x8a, 0xdd, 0x6c, 0x69, + 0x71, 0x23, 0x62, 0x2b, 0x81, 0x22, 0x51, 0x40, 0xc2, 0x71, 0x5c, 0xd5, 0x6a, 0x6a, 0x57, 0xeb, + 0xb4, 0x52, 0x29, 0xd2, 0x6a, 0xb3, 0x9e, 0x38, 0x4b, 0xec, 0x9d, 0x65, 0x67, 0x6c, 0xea, 0x9e, + 0x10, 0x27, 0xc4, 0x05, 0xae, 0x48, 0x1c, 0x7a, 0x42, 0x1c, 0x7b, 0xe8, 0xb5, 0x42, 0x88, 0x4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4, 0xae, 0x6d, 0xc8, + 0x8c, 0xca, 0x40, 0x85, 0x30, 0x7e, 0x5e, 0x7b, 0xcd, 0x83, 0xe0, 0x75, 0x37, 0xce, 0x1c, 0xcc, + 0x59, 0x86, 0x7f, 0x13, 0xc0, 0x26, 0x9d, 0x8e, 0x43, 0xa9, 0x43, 0xdc, 0xf4, 0x09, 0xa1, 0xae, + 0x17, 0x54, 0xd3, 0x04, 0xed, 0xac, 0xda, 0xbb, 0x50, 0x1e, 0x30, 0x97, 0x63, 0xbc, 0x13, 0x7f, + 0xd9, 0x7b, 0x34, 0xaf, 0x19, 0x21, 0x01, 0xfd, 0x27, 0x0d, 0x62, 0x75, 0x8f, 0xe1, 0xa6, 0x48, + 0xe5, 0x22, 0xcc, 0xd0, 0xb6, 0x45, 0x37, 0x4d, 0x9b, 0xb8, 0xcc, 0xb7, 0x6c, 0xd5, 0xc6, 0x46, + 0x42, 0xa0, 0x65, 0x05, 0xa2, 0x4b, 0x90, 0x24, 0xdc, 0xc7, 0x74, 0x5c, 0x73, 0x13, 0x3b, 0xad, + 0x4d, 0x26, 0xaa, 0x38, 0x6e, 0x24, 0x88, 0x94, 0xba, 0x2e, 0x40, 0x94, 0x87, 0x94, 0xe4, 0x91, + 0x2e, 0x0b, 0x88, 0x51, 0x41, 0x9c, 0x11, 0x78, 0xbd, 0xcb, 0x14, 0xf3, 0x34, 0x4c, 0x7c, 0x61, + 0x39, 0x6d, 0xdc, 0x14, 0xf5, 0x9a, 0x32, 0xd4, 0x4a, 0x7f, 0xa2, 0xc1, 0x49, 0x15, 0x5e, 0x89, + 0x52, 0xcc, 0x1a, 0xcc, 0x62, 0xf8, 0x58, 0x53, 0x56, 0x75, 0x59, 0x68, 0xca, 0xaa, 0x2e, 0x0b, + 0xa6, 0x0c, 0x19, 0x70, 0xa2, 0xc7, 0x27, 0x59, 0x76, 0xc4, 0x31, 0x47, 0x57, 0x4a, 0xe9, 0xff, + 0x8c, 0xf1, 0xf8, 0xe5, 0x89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, 0x3f, 0x95, 0x30, 0x20, 0xb3, 0x9a, 0x6f, 0x43, 0x6c, 0x30, 0x67, 0x28, 0x03, 0xa7, 0x1b, + 0xab, 0xa5, 0xc6, 0x75, 0x73, 0xed, 0xee, 0xad, 0x8a, 0x79, 0xbb, 0xd6, 0xb8, 0x55, 0x29, 0x57, + 0xaf, 0x55, 0x2b, 0x2b, 0xa9, 0x08, 0x3a, 0x07, 0xe9, 0x90, 0xad, 0x5a, 0x6b, 0xac, 0x95, 0x6a, + 0x6b, 0xa6, 0x80, 0x52, 0x1a, 0xba, 0x08, 0x73, 0x21, 0x6b, 0xad, 0x1e, 0x10, 0x4a, 0xb5, 0x4a, + 0xfd, 0x76, 0x43, 0xd1, 0xc6, 0x96, 0xbe, 0x8f, 0x42, 0xf4, 0x26, 0x6d, 0xa1, 0x2d, 0x48, 0xbd, + 0x38, 0x03, 0x28, 0x3f, 0x72, 0xec, 0x46, 0xcc, 0x7a, 0x66, 0xe1, 0x15, 0x99, 0x32, 0x45, 0x74, + 0x0f, 0x60, 0x3f, 0x71, 0xa4, 0x8f, 0xbe, 0x6b, 0xc2, 0xa5, 0xca, 0xbc, 0x73, 0x24, 0x47, 0xf5, + 0x44, 0x04, 0xdd, 0x05, 0xd8, 0xef, 0xf5, 0x43, 0xc4, 0x87, 0xa6, 0xe3, 0x10, 0xf1, 0x83, 0x03, + 0x83, 0x3e, 0x87, 0x78, 0xa8, 0x0f, 0xd1, 0x85, 0xc3, 0xfc, 0x42, 0xbd, 0x9b, 0xc9, 0x1f, 0x4d, + 0x92, 0xea, 0x99, 0x13, 0x5f, 0xf3, 0x57, 0xc3, 0xf2, 0xea, 0xd3, 0x9d, 0xac, 0xf6, 0x6c, 0x27, + 0xab, 0xfd, 0xb5, 0x93, 0xd5, 0x7e, 0xd8, 0xcd, 0x46, 0x9e, 0xed, 0x66, 0x23, 0x7f, 0xec, 0x66, + 0x23, 0x9f, 0x2d, 0x85, 0xee, 0xfb, 0x8a, 0x14, 0xad, 0x61, 0xf6, 0x15, 0xf1, 0xb7, 0x8a, 0xc1, + 0xab, 0xfe, 0xfe, 0xfe, 0xbb, 0x5e, 0xdc, 0xff, 0xeb, 0x13, 0xe2, 0x01, 0xfd, 0xde, 0xbf, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x31, 0x4a, 0x45, 0x23, 0xf8, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -881,17 +934,14 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // RegisterOperator registers a new operator. RegisterOperator(ctx context.Context, in *RegisterOperatorReq, opts ...grpc.CallOption) (*RegisterOperatorResponse, error) - // add services for dogfood - // OptInToCosmosChain acts as opt in method for an operator to - // start validatring on a chain. The operator must sign the request with - // the key with which they registered in the system. - OptInToCosmosChain(ctx context.Context, in *OptInToCosmosChainRequest, opts ...grpc.CallOption) (*OptInToCosmosChainResponse, error) - // InitOptOutFromCosmosChain is a method with which an operator can initiate - // the opt out process from a chain. The operator must sign the request with - // the key with which they registered in the system. The opt-out process takes - // as long as the chain's unbonding period to complete, plus some loose change - // for message relaying across chains. - InitOptOutFromCosmosChain(ctx context.Context, in *InitOptOutFromCosmosChainRequest, opts ...grpc.CallOption) (*InitOptOutFromCosmosChainResponse, error) + // SetConsKey sets the operator's consensus key for a chain. To do this, the operator + // must have previously opted into the chain. + // TODO; rationalize this with non-chain AVSs wherein other keys can be set. + SetConsKey(ctx context.Context, in *SetConsKeyReq, opts ...grpc.CallOption) (*SetConsKeyResponse, error) + // OptIntoAVS opts an operator into an AVS. + OptIntoAVS(ctx context.Context, in *OptIntoAVSReq, opts ...grpc.CallOption) (*OptIntoAVSResponse, error) + // OptOutOfAVS opts an operator out of an AVS. + OptOutOfAVS(ctx context.Context, in *OptOutOfAVSReq, opts ...grpc.CallOption) (*OptOutOfAVSResponse, error) } type msgClient struct { @@ -911,18 +961,27 @@ func (c *msgClient) RegisterOperator(ctx context.Context, in *RegisterOperatorRe return out, nil } -func (c *msgClient) OptInToCosmosChain(ctx context.Context, in *OptInToCosmosChainRequest, opts ...grpc.CallOption) (*OptInToCosmosChainResponse, error) { - out := new(OptInToCosmosChainResponse) - err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/OptInToCosmosChain", in, out, opts...) +func (c *msgClient) SetConsKey(ctx context.Context, in *SetConsKeyReq, opts ...grpc.CallOption) (*SetConsKeyResponse, error) { + out := new(SetConsKeyResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/SetConsKey", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) InitOptOutFromCosmosChain(ctx context.Context, in *InitOptOutFromCosmosChainRequest, opts ...grpc.CallOption) (*InitOptOutFromCosmosChainResponse, error) { - out := new(InitOptOutFromCosmosChainResponse) - err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/InitOptOutFromCosmosChain", in, out, opts...) +func (c *msgClient) OptIntoAVS(ctx context.Context, in *OptIntoAVSReq, opts ...grpc.CallOption) (*OptIntoAVSResponse, error) { + out := new(OptIntoAVSResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/OptIntoAVS", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) OptOutOfAVS(ctx context.Context, in *OptOutOfAVSReq, opts ...grpc.CallOption) (*OptOutOfAVSResponse, error) { + out := new(OptOutOfAVSResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/OptOutOfAVS", in, out, opts...) if err != nil { return nil, err } @@ -933,17 +992,14 @@ func (c *msgClient) InitOptOutFromCosmosChain(ctx context.Context, in *InitOptOu type MsgServer interface { // RegisterOperator registers a new operator. RegisterOperator(context.Context, *RegisterOperatorReq) (*RegisterOperatorResponse, error) - // add services for dogfood - // OptInToCosmosChain acts as opt in method for an operator to - // start validatring on a chain. The operator must sign the request with - // the key with which they registered in the system. - OptInToCosmosChain(context.Context, *OptInToCosmosChainRequest) (*OptInToCosmosChainResponse, error) - // InitOptOutFromCosmosChain is a method with which an operator can initiate - // the opt out process from a chain. The operator must sign the request with - // the key with which they registered in the system. The opt-out process takes - // as long as the chain's unbonding period to complete, plus some loose change - // for message relaying across chains. - InitOptOutFromCosmosChain(context.Context, *InitOptOutFromCosmosChainRequest) (*InitOptOutFromCosmosChainResponse, error) + // SetConsKey sets the operator's consensus key for a chain. To do this, the operator + // must have previously opted into the chain. + // TODO; rationalize this with non-chain AVSs wherein other keys can be set. + SetConsKey(context.Context, *SetConsKeyReq) (*SetConsKeyResponse, error) + // OptIntoAVS opts an operator into an AVS. + OptIntoAVS(context.Context, *OptIntoAVSReq) (*OptIntoAVSResponse, error) + // OptOutOfAVS opts an operator out of an AVS. + OptOutOfAVS(context.Context, *OptOutOfAVSReq) (*OptOutOfAVSResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -953,11 +1009,14 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) RegisterOperator(ctx context.Context, req *RegisterOperatorReq) (*RegisterOperatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterOperator not implemented") } -func (*UnimplementedMsgServer) OptInToCosmosChain(ctx context.Context, req *OptInToCosmosChainRequest) (*OptInToCosmosChainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method OptInToCosmosChain not implemented") +func (*UnimplementedMsgServer) SetConsKey(ctx context.Context, req *SetConsKeyReq) (*SetConsKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetConsKey not implemented") } -func (*UnimplementedMsgServer) InitOptOutFromCosmosChain(ctx context.Context, req *InitOptOutFromCosmosChainRequest) (*InitOptOutFromCosmosChainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InitOptOutFromCosmosChain not implemented") +func (*UnimplementedMsgServer) OptIntoAVS(ctx context.Context, req *OptIntoAVSReq) (*OptIntoAVSResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OptIntoAVS not implemented") +} +func (*UnimplementedMsgServer) OptOutOfAVS(ctx context.Context, req *OptOutOfAVSReq) (*OptOutOfAVSResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OptOutOfAVS not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { @@ -982,38 +1041,56 @@ func _Msg_RegisterOperator_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _Msg_OptInToCosmosChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OptInToCosmosChainRequest) +func _Msg_SetConsKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetConsKeyReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).OptInToCosmosChain(ctx, in) + return srv.(MsgServer).SetConsKey(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/exocore.operator.v1.Msg/OptInToCosmosChain", + FullMethod: "/exocore.operator.v1.Msg/SetConsKey", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).OptInToCosmosChain(ctx, req.(*OptInToCosmosChainRequest)) + return srv.(MsgServer).SetConsKey(ctx, req.(*SetConsKeyReq)) } return interceptor(ctx, in, info, handler) } -func _Msg_InitOptOutFromCosmosChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InitOptOutFromCosmosChainRequest) +func _Msg_OptIntoAVS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OptIntoAVSReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).InitOptOutFromCosmosChain(ctx, in) + return srv.(MsgServer).OptIntoAVS(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/exocore.operator.v1.Msg/InitOptOutFromCosmosChain", + FullMethod: "/exocore.operator.v1.Msg/OptIntoAVS", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).InitOptOutFromCosmosChain(ctx, req.(*InitOptOutFromCosmosChainRequest)) + return srv.(MsgServer).OptIntoAVS(ctx, req.(*OptIntoAVSReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_OptOutOfAVS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OptOutOfAVSReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).OptOutOfAVS(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Msg/OptOutOfAVS", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).OptOutOfAVS(ctx, req.(*OptOutOfAVSReq)) } return interceptor(ctx, in, info, handler) } @@ -1027,12 +1104,16 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_RegisterOperator_Handler, }, { - MethodName: "OptInToCosmosChain", - Handler: _Msg_OptInToCosmosChain_Handler, + MethodName: "SetConsKey", + Handler: _Msg_SetConsKey_Handler, }, { - MethodName: "InitOptOutFromCosmosChain", - Handler: _Msg_InitOptOutFromCosmosChain_Handler, + MethodName: "OptIntoAVS", + Handler: _Msg_OptIntoAVS_Handler, + }, + { + MethodName: "OptOutOfAVS", + Handler: _Msg_OptOutOfAVS_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -1438,7 +1519,7 @@ func (m *RegisterOperatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *OptInToCosmosChainRequest) Marshal() (dAtA []byte, err error) { +func (m *OptIntoAVSReq) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1448,12 +1529,12 @@ func (m *OptInToCosmosChainRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *OptInToCosmosChainRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *OptIntoAVSReq) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *OptInToCosmosChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OptIntoAVSReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1465,24 +1546,24 @@ func (m *OptInToCosmosChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro i-- dAtA[i] = 0x1a } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainId))) + if len(m.AvsAddress) > 0 { + i -= len(m.AvsAddress) + copy(dAtA[i:], m.AvsAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.AvsAddress))) i-- dAtA[i] = 0x12 } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + 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 *OptInToCosmosChainResponse) Marshal() (dAtA []byte, err error) { +func (m *OptIntoAVSResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1492,12 +1573,12 @@ func (m *OptInToCosmosChainResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *OptInToCosmosChainResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *OptIntoAVSResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *OptInToCosmosChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OptIntoAVSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1505,7 +1586,7 @@ func (m *OptInToCosmosChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *InitOptOutFromCosmosChainRequest) Marshal() (dAtA []byte, err error) { +func (m *OptOutOfAVSReq) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1515,20 +1596,87 @@ func (m *InitOptOutFromCosmosChainRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InitOptOutFromCosmosChainRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *OptOutOfAVSReq) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *InitOptOutFromCosmosChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OptOutOfAVSReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainId))) + if len(m.AvsAddress) > 0 { + i -= len(m.AvsAddress) + copy(dAtA[i:], m.AvsAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.AvsAddress))) + 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 *OptOutOfAVSResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OptOutOfAVSResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OptOutOfAVSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *SetConsKeyReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetConsKeyReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SetConsKeyReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PublicKey) > 0 { + i -= len(m.PublicKey) + copy(dAtA[i:], m.PublicKey) + i = encodeVarintTx(dAtA, i, uint64(len(m.PublicKey))) + i-- + dAtA[i] = 0x1a + } + 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] = 0x12 } @@ -1542,7 +1690,7 @@ func (m *InitOptOutFromCosmosChainRequest) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func (m *InitOptOutFromCosmosChainResponse) Marshal() (dAtA []byte, err error) { +func (m *SetConsKeyResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1552,12 +1700,12 @@ func (m *InitOptOutFromCosmosChainResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InitOptOutFromCosmosChainResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *SetConsKeyResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *InitOptOutFromCosmosChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SetConsKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1736,17 +1884,17 @@ func (m *RegisterOperatorResponse) Size() (n int) { return n } -func (m *OptInToCosmosChainRequest) Size() (n int) { +func (m *OptIntoAVSReq) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Address) + l = len(m.FromAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ChainId) + l = len(m.AvsAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1757,7 +1905,7 @@ func (m *OptInToCosmosChainRequest) Size() (n int) { return n } -func (m *OptInToCosmosChainResponse) Size() (n int) { +func (m *OptIntoAVSResponse) Size() (n int) { if m == nil { return 0 } @@ -1766,7 +1914,33 @@ func (m *OptInToCosmosChainResponse) Size() (n int) { return n } -func (m *InitOptOutFromCosmosChainRequest) Size() (n int) { +func (m *OptOutOfAVSReq) 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.AvsAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *OptOutOfAVSResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *SetConsKeyReq) Size() (n int) { if m == nil { return 0 } @@ -1776,14 +1950,18 @@ func (m *InitOptOutFromCosmosChainRequest) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ChainId) + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.PublicKey) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *InitOptOutFromCosmosChainResponse) Size() (n int) { +func (m *SetConsKeyResponse) Size() (n int) { if m == nil { return 0 } @@ -2920,7 +3098,7 @@ func (m *RegisterOperatorResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *OptInToCosmosChainRequest) Unmarshal(dAtA []byte) error { +func (m *OptIntoAVSReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2943,15 +3121,15 @@ func (m *OptInToCosmosChainRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: OptInToCosmosChainRequest: wiretype end group for non-group") + return fmt.Errorf("proto: OptIntoAVSReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: OptInToCosmosChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OptIntoAVSReq: 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) + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2979,11 +3157,11 @@ func (m *OptInToCosmosChainRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.FromAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AvsAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3011,7 +3189,7 @@ func (m *OptInToCosmosChainRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.AvsAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -3066,7 +3244,171 @@ func (m *OptInToCosmosChainRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *OptInToCosmosChainResponse) Unmarshal(dAtA []byte) error { +func (m *OptIntoAVSResponse) Unmarshal(dAtA []byte) 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: OptIntoAVSResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OptIntoAVSResponse: 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 *OptOutOfAVSReq) Unmarshal(dAtA []byte) 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: OptOutOfAVSReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OptOutOfAVSReq: 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 AvsAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AvsAddress = 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 *OptOutOfAVSResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3089,10 +3431,10 @@ func (m *OptInToCosmosChainResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: OptInToCosmosChainResponse: wiretype end group for non-group") + return fmt.Errorf("proto: OptOutOfAVSResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: OptInToCosmosChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OptOutOfAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3116,7 +3458,7 @@ func (m *OptInToCosmosChainResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *InitOptOutFromCosmosChainRequest) Unmarshal(dAtA []byte) error { +func (m *SetConsKeyReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3139,10 +3481,10 @@ func (m *InitOptOutFromCosmosChainRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InitOptOutFromCosmosChainRequest: wiretype end group for non-group") + return fmt.Errorf("proto: SetConsKeyReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InitOptOutFromCosmosChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SetConsKeyReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3179,7 +3521,7 @@ func (m *InitOptOutFromCosmosChainRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3207,7 +3549,39 @@ func (m *InitOptOutFromCosmosChainRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ChainID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PublicKey = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3230,7 +3604,7 @@ func (m *InitOptOutFromCosmosChainRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *InitOptOutFromCosmosChainResponse) Unmarshal(dAtA []byte) error { +func (m *SetConsKeyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3253,10 +3627,10 @@ func (m *InitOptOutFromCosmosChainResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InitOptOutFromCosmosChainResponse: wiretype end group for non-group") + return fmt.Errorf("proto: SetConsKeyResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InitOptOutFromCosmosChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SetConsKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/operator/types/validation.go b/x/operator/types/validation.go new file mode 100644 index 000000000..2ebb6b46b --- /dev/null +++ b/x/operator/types/validation.go @@ -0,0 +1,49 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +func (info *OperatorInfo) ValidateBasic() error { + // basic check 1 + if info == nil { + return errorsmod.Wrap( + ErrParameterInvalid, "ValidateBasic: info is nil", + ) + } + // basic check 2 + _, err := sdk.AccAddressFromBech32(info.EarningsAddr) + if err != nil { + return errorsmod.Wrap( + err, "ValidateBasic: error occurred when parse acc address from Bech32", + ) + } + // do not allow empty operator info + if info.OperatorMetaInfo == "" { + return errorsmod.Wrap( + ErrParameterInvalid, "ValidateBasic: operator meta info is empty", + ) + } + // do not allow operator info to exceed the maximum length + if len(info.OperatorMetaInfo) > stakingtypes.MaxIdentityLength { + return errorsmod.Wrapf( + ErrParameterInvalid, + "ValidateBasic: info length exceeds %d", stakingtypes.MaxIdentityLength, + ) + } + // do not allow empty approve address + if info.ApproveAddr == "" { + return errorsmod.Wrap( + ErrParameterInvalid, + "ValidateBasic: approve address is empty", + ) + } + // TODO(Chuang): should the approve address be bech32 validated? + if err := info.Commission.Validate(); err != nil { + return errorsmod.Wrap(err, "ValidateBasic: invalid commission rate") + } + return nil +} diff --git a/x/oracle/keeper/aggregator/aggregator.go b/x/oracle/keeper/aggregator/aggregator.go index 991612cf8..5da005a60 100644 --- a/x/oracle/keeper/aggregator/aggregator.go +++ b/x/oracle/keeper/aggregator/aggregator.go @@ -48,6 +48,36 @@ type aggregator struct { dsPrices map[uint64]string } +func (agg *aggregator) copy4CheckTx() *aggregator { + ret := &aggregator{ + finalPrice: big.NewInt(0).Set(agg.finalPrice), + reportPower: big.NewInt(0).Set(agg.reportPower), + totalPower: big.NewInt(0).Set(agg.totalPower), + + reports: make([]*reportPrice, 0, len(agg.reports)), + dsPrices: make(map[uint64]string), + } + for k, v := range agg.dsPrices { + ret.dsPrices[k] = v + } + for _, report := range agg.reports { + rTmp := *report + rTmp.price = big.NewInt(0).Set(report.price) + rTmp.power = big.NewInt(0).Set(report.power) + + for k, v := range report.prices { + // prices are information submitted by validators, these data will not change under deterministic sources, but with non-deterministic sources they might be overwrite by later prices + tmpV := *v + tmpV.price = big.NewInt(0).Set(v.price) + rTmp.prices[k] = &tmpV + } + + ret.reports = append(ret.reports, &rTmp) + } + + return ret +} + // fill price from validator submitting into aggregator, and calculation the voting power and check with the consensus status of deterministic source value to decide when to do the aggregation // TODO: currently apply mode=1 in V1, add swith modes func (agg *aggregator) fillPrice(pSources []*types.PriceSource, validator string, power *big.Int) { diff --git a/x/oracle/keeper/aggregator/calculator.go b/x/oracle/keeper/aggregator/calculator.go index 5cdc0f8df..9ee504d25 100644 --- a/x/oracle/keeper/aggregator/calculator.go +++ b/x/oracle/keeper/aggregator/calculator.go @@ -66,6 +66,31 @@ type roundPricesList struct { roundPricesCount int } +func (r *roundPricesList) copy4CheckTx() *roundPricesList { + ret := &roundPricesList{ + roundPricesList: make([]*roundPrices, 0, len(r.roundPricesList)), + roundPricesCount: r.roundPricesCount, + } + + for _, v := range r.roundPricesList { + tmpRP := &roundPrices{ + detID: v.detID, + price: big.NewInt(0).Set(v.price), + prices: make([]*priceAndPower, 0, len(v.prices)), + timestamp: v.timestamp, + } + for _, pNP := range v.prices { + tmpPNP := *pNP + // power will be modified during execution + tmpPNP.power = big.NewInt(0).Set(pNP.power) + tmpRP.prices = append(tmpRP.prices, &tmpPNP) + } + + ret.roundPricesList = append(ret.roundPricesList, tmpRP) + } + return ret +} + // to tell if any round of this DS has reached consensus/confirmed func (r *roundPricesList) hasConfirmedDetID() bool { for _, round := range r.roundPricesList { @@ -108,9 +133,20 @@ type calculator struct { totalPower *big.Int } +func (c *calculator) copy4CheckTx() *calculator { + ret := newCalculator(c.validatorLength, c.totalPower) + + // copy deterministicSource + for k, v := range c.deterministicSource { + ret.deterministicSource[k] = v.copy4CheckTx() + } + + return ret +} + func (c *calculator) newRoundPricesList() *roundPricesList { return &roundPricesList{ - roundPricesList: make([]*roundPrices, 0, common.MaxDetID*c.validatorLength), + roundPricesList: make([]*roundPrices, 0, int(common.MaxDetID)*c.validatorLength), // for each DS-roundId, the count of prices provided is the number of validators at most roundPricesCount: c.validatorLength, } diff --git a/x/oracle/keeper/aggregator/context.go b/x/oracle/keeper/aggregator/context.go index d061daa07..6726634f6 100644 --- a/x/oracle/keeper/aggregator/context.go +++ b/x/oracle/keeper/aggregator/context.go @@ -42,6 +42,35 @@ type AggregatorContext struct { aggregators map[uint64]*worker } +func (agc *AggregatorContext) Copy4CheckTx() *AggregatorContext { + ret := &AggregatorContext{ + // params, validatorsPower, totalPower, these values won't change during block executing + params: agc.params, + validatorsPower: agc.validatorsPower, + totalPower: agc.totalPower, + + rounds: make(map[uint64]*roundInfo), + aggregators: make(map[uint64]*worker), + } + + for k, v := range agc.rounds { + vTmp := *v + ret.rounds[k] = &vTmp + } + + for k, v := range agc.aggregators { + w := newWorker(k, ret) + w.sealed = v.sealed + w.price = v.price + + w.f = v.f.copy4CheckTx() + w.c = v.c.copy4CheckTx() + w.a = v.a.copy4CheckTx() + } + + return ret +} + func (agc *AggregatorContext) sanityCheck(msg *types.MsgCreatePrice) error { // sanity check // TODO: check nonce [1,3] in anteHandler, related to params, may not able @@ -63,7 +92,7 @@ func (agc *AggregatorContext) sanityCheck(msg *types.MsgCreatePrice) error { } for _, pSource := range msg.Prices { - if pSource.Prices == nil || len(pSource.Prices) == 0 || len(pSource.Prices) > common.MaxDetID || !agc.params.IsValidSource(pSource.SourceID) { + if pSource.Prices == nil || len(pSource.Prices) == 0 || len(pSource.Prices) > int(common.MaxDetID) || !agc.params.IsValidSource(pSource.SourceID) { return errors.New("source should be valid and provide at least one price") } // check with params is coressponding source is deteministic @@ -173,7 +202,8 @@ func (agc *AggregatorContext) SealRound(ctx sdk.Context, force bool) (success [] delete(agc.aggregators, feederID) } else { round.status = 2 - agc.aggregators[feederID] = nil + // agc.aggregators[feederID] = nil + delete(agc.aggregators, feederID) } } default: @@ -182,7 +212,8 @@ func (agc *AggregatorContext) SealRound(ctx sdk.Context, force bool) (success [] } // all status: 1->2, remove its aggregator if agc.aggregators[feederID] != nil && agc.aggregators[feederID].sealed { - agc.aggregators[feederID] = nil + // agc.aggregators[feederID] = nil + delete(agc.aggregators, feederID) } } return success, failed @@ -216,7 +247,7 @@ func (agc *AggregatorContext) PrepareRound(ctx sdk.Context, block uint64) { basedBlock: latestBasedblock, nextRoundID: latestNextRoundID, } - if left >= common.MaxNonce { + if left >= uint64(common.MaxNonce) { round.status = 2 } else { round.status = 1 @@ -229,8 +260,8 @@ func (agc *AggregatorContext) PrepareRound(ctx sdk.Context, block uint64) { round.nextRoundID = latestNextRoundID round.status = 1 // drop previous worker - agc.aggregators[feederIDUint64] = nil - } else if round.status == 1 && left >= common.MaxNonce { + delete(agc.aggregators, feederIDUint64) + } else if round.status == 1 && left >= uint64(common.MaxNonce) { // this shouldn't happen, if do sealround properly before prepareRound, basically for test only round.status = 2 // TODO: just modify the status here, since sealRound should do all the related seal actios already when parepare invoked diff --git a/x/oracle/keeper/aggregator/context_test.go b/x/oracle/keeper/aggregator/context_test.go index f8a464c53..65f839753 100644 --- a/x/oracle/keeper/aggregator/context_test.go +++ b/x/oracle/keeper/aggregator/context_test.go @@ -27,7 +27,7 @@ func TestAggregatorContext(t *testing.T) { Convey("update already exist round info", func() { p.Reset() time.Sleep(1 * time.Second) - patchBlockHeight(10 + common.MaxNonce) + patchBlockHeight(10 + int64(common.MaxNonce)) agc.PrepareRound(ctx, 0) So(agc.rounds[1].status, ShouldEqual, 2) @@ -37,7 +37,7 @@ func TestAggregatorContext(t *testing.T) { }) Convey("pepare outside the window", func() { Convey("for empty round list", func() { - p := patchBlockHeight(10 + common.MaxNonce) + p := patchBlockHeight(10 + int64(common.MaxNonce)) agc.PrepareRound(ctx, 0) So(agc.rounds[1].status, ShouldEqual, 2) p.Reset() diff --git a/x/oracle/keeper/aggregator/filter.go b/x/oracle/keeper/aggregator/filter.go index bbedd31b4..da376a531 100644 --- a/x/oracle/keeper/aggregator/filter.go +++ b/x/oracle/keeper/aggregator/filter.go @@ -25,6 +25,22 @@ func newFilter(maxNonce, maxDetID int) *filter { } } +func (f *filter) copy4CheckTx() *filter { + ret := *f + ret.validatorNonce = make(map[string]*common.Set[int32], len(f.validatorNonce)) + ret.validatorSource = make(map[string]*common.Set[string], len(f.validatorSource)) + + for k, v := range f.validatorNonce { + ret.validatorNonce[k] = v.Copy() + } + + for k, v := range f.validatorSource { + ret.validatorSource[k] = v.Copy() + } + + return &ret +} + func (f *filter) newVNSet() *common.Set[int32] { return common.NewSet[int32](f.maxNonce) } diff --git a/x/oracle/keeper/aggregator/info_test.go b/x/oracle/keeper/aggregator/info_test.go index 72b0e647d..72b19f2d2 100644 --- a/x/oracle/keeper/aggregator/info_test.go +++ b/x/oracle/keeper/aggregator/info_test.go @@ -48,8 +48,13 @@ var ( var defaultParams = types.Params{ Chains: []*types.Chain{{Name: "-", Desc: "-"}, {Name: "Ethereum", Desc: "-"}}, - Tokens: []*types.Token{{}, {Name: "eth", ChainID: 1, ContractAddress: "0xabc", Decimal: 18, Active: true}}, + Tokens: []*types.Token{{}, {Name: "eth", ChainID: 1, ContractAddress: "0xabc", Decimal: 18, Active: true, AssetID: ""}}, Sources: []*types.Source{{}, {Name: "chainLink", Entry: &types.Endpoint{}, Valid: true, Deterministic: true}}, Rules: []*types.RuleSource{{}, {SourceIDs: []uint64{1}}}, TokenFeeders: []*types.TokenFeeder{{}, {TokenID: 1, RuleID: 1, StartRoundID: 1, StartBaseBlock: 0, Interval: 10, EndBlock: 0}}, + MaxNonce: 3, + ThresholdA: 2, + ThresholdB: 3, + Mode: 1, + MaxDetId: 5, } diff --git a/x/oracle/keeper/aggregator/worker.go b/x/oracle/keeper/aggregator/worker.go index 1dfe76351..f4e2057f9 100644 --- a/x/oracle/keeper/aggregator/worker.go +++ b/x/oracle/keeper/aggregator/worker.go @@ -53,7 +53,7 @@ func (w *worker) seal() { // newWorker new a instance for a tokenFeeder's specific round func newWorker(feederID uint64, agc *AggregatorContext) *worker { return &worker{ - f: newFilter(common.MaxNonce, common.MaxDetID), + f: newFilter(int(common.MaxNonce), int(common.MaxDetID)), c: newCalculator(len(agc.validatorsPower), agc.totalPower), a: newAggregator(len(agc.validatorsPower), agc.totalPower), decimal: agc.params.GetTokenInfo(feederID).Decimal, diff --git a/x/oracle/keeper/cache/caches.go b/x/oracle/keeper/cache/caches.go index 67549a136..0870ea13b 100644 --- a/x/oracle/keeper/cache/caches.go +++ b/x/oracle/keeper/cache/caches.go @@ -13,20 +13,17 @@ var zeroBig = big.NewInt(0) type ( ItemV map[string]*big.Int ItemP *common.Params - ItemM struct { - FeederID uint64 - PSources []*types.PriceSource - Validator string - } + ItemM types.MsgItem ) type Cache struct { - msg cacheMsgs + msg *cacheMsgs validators *cacheValidator params *cacheParams } -type cacheMsgs map[uint64][]*ItemM +// type cacheMsgs map[uint64][]*ItemM +type cacheMsgs []*ItemM // used to track validator change type cacheValidator struct { @@ -40,54 +37,44 @@ type cacheParams struct { update bool } -func (c cacheMsgs) add(item *ItemM) { - if ims, ok := c[item.FeederID]; ok { - for _, im := range ims { - if im.Validator == item.Validator { - for _, p := range im.PSources { - for _, pInput := range item.PSources { - if p.SourceID == pInput.SourceID { - p.Prices = append(p.Prices, pInput.Prices...) - return - } - } - } - im.PSources = append(im.PSources, item.PSources...) - return - } - } - } - c[item.FeederID] = append(c[item.FeederID], item) +func (c *cacheMsgs) add(item *ItemM) { + *c = append(*c, item) } -func (c cacheMsgs) remove(item *ItemM) { - delete(c, item.FeederID) +// remove removes all items with the same feederID +func (c *cacheMsgs) remove(item *ItemM) { + var newCache []*ItemM + for _, msg := range *c { + if msg.FeederID != item.FeederID { + newCache = append(newCache, msg) + } + } + *c = newCache } func (c cacheMsgs) commit(ctx sdk.Context, k common.KeeperOracle) { block := uint64(ctx.BlockHeight()) + recentMsgs := types.RecentMsg{ Block: block, Msgs: make([]*types.MsgItem, 0), } - for _, msgs4Feeder := range c { - for _, msg := range msgs4Feeder { - recentMsgs.Msgs = append(recentMsgs.Msgs, &types.MsgItem{ - FeederID: msg.FeederID, - PSources: msg.PSources, - Validator: msg.Validator, - }) - } + + for _, msg := range c { + msgTmp := types.MsgItem(*msg) + recentMsgs.Msgs = append(recentMsgs.Msgs, &msgTmp) } index, _ := k.GetIndexRecentMsg(ctx) for i, b := range index.Index { - if b >= block-common.MaxNonce { + if b >= block-uint64(common.MaxNonce) { index.Index = index.Index[i:] break } k.RemoveRecentMsg(ctx, b) } + k.SetRecentMsg(ctx, recentMsgs) + index.Index = append(index.Index, block) k.SetIndexRecentMsg(ctx, index) } @@ -128,7 +115,7 @@ func (c *cacheParams) commit(ctx sdk.Context, k common.KeeperOracle) { i := 0 for ; i < len(index.Index); i++ { b := index.Index[i] - if b >= block-common.MaxNonce { + if b >= block-uint64(common.MaxNonce) { index.Index = index.Index[i:] break } @@ -151,7 +138,6 @@ func (c *Cache) AddCache(i any) { switch item := i.(type) { case *ItemM: c.msg.add(item) - // case *params: case ItemP: c.params.add(item) case ItemV: @@ -161,7 +147,7 @@ func (c *Cache) AddCache(i any) { } } -// func (c *Cache) RemoveCache(i any, k common.KeeperOracle) { +// RemoveCache removes all cached msgs with the same feederID func (c *Cache) RemoveCache(i any) { if item, isItemM := i.(*ItemM); isItemM { c.msg.remove(item) @@ -177,24 +163,22 @@ func (c *Cache) GetCache(i any) bool { for addr, power := range c.validators.validators { item[addr] = power } + return c.validators.update case ItemP: if item == nil { return false } *item = *(c.params.params) - case *[]*ItemM: + return c.params.update + case *([]*ItemM): if item == nil { return false } - tmp := make([]*ItemM, 0, len(c.msg)) - for _, msgs := range c.msg { - tmp = append(tmp, msgs...) - } - *item = tmp + *item = *c.msg + return len(*c.msg) > 0 default: return false } - return true } // SkipCommit skip real commit by setting the updage flag to false @@ -204,9 +188,9 @@ func (c *Cache) SkipCommit() { } func (c *Cache) CommitCache(ctx sdk.Context, reset bool, k common.KeeperOracle) { - if len(c.msg) > 0 { + if len(*(c.msg)) > 0 { c.msg.commit(ctx, k) - c.msg = make(map[uint64][]*ItemM) + *(c.msg) = make([]*ItemM, 0) } if c.validators.update { @@ -229,7 +213,7 @@ func (c *Cache) ResetCaches() { func NewCache() *Cache { return &Cache{ - msg: make(map[uint64][]*ItemM), + msg: new(cacheMsgs), validators: &cacheValidator{ validators: make(map[string]*big.Int), }, diff --git a/x/oracle/keeper/cache/caches_test.go b/x/oracle/keeper/cache/caches_test.go index 25ad6ee48..c47e329f0 100644 --- a/x/oracle/keeper/cache/caches_test.go +++ b/x/oracle/keeper/cache/caches_test.go @@ -93,9 +93,20 @@ func TestCache(t *testing.T) { Convey("add more items", func() { c.AddCache(msgItems[1]) c.AddCache(msgItems[2]) + + c.GetCache(&msgItemsReturn) + So(msgItemsReturn, ShouldContain, msgItems[0]) + So(msgItemsReturn, ShouldContain, msgItems[2]) + }) + Convey("remove two items with same feederID", func() { + c.AddCache(msgItems[1]) + c.AddCache(msgItems[2]) + c.RemoveCache(msgItems[0]) + c.GetCache(&msgItemsReturn) So(msgItemsReturn, ShouldContain, msgItems[2]) So(msgItemsReturn, ShouldNotContain, msgItems[0]) + So(msgItemsReturn, ShouldNotContain, msgItems[1]) }) }) }) diff --git a/x/oracle/keeper/common/types.go b/x/oracle/keeper/common/types.go index 4d82e1115..97dfe481a 100644 --- a/x/oracle/keeper/common/types.go +++ b/x/oracle/keeper/common/types.go @@ -8,20 +8,20 @@ import ( "github.com/ExocoreNetwork/exocore/x/oracle/types" ) -const ( +var ( // maxNonce indicates how many messages a validator can submit in a single round to offer price // current we use this as a mock distance - MaxNonce = 3 + MaxNonce int32 = 3 // these two threshold value used to set the threshold to tell when the price had come to consensus and was able to get a final price of that round - ThresholdA = 2 - ThresholdB = 3 + ThresholdA int32 = 2 + ThresholdB int32 = 3 // maxDetId each validator can submit, so the calculator can cache maximum of maxDetId*count(validators) values, this is for resistance of malicious validator submmiting invalid detId - MaxDetID = 5 + MaxDetID int32 = 5 // consensus mode: v1: as soon as possbile - Mode = 1 + Mode int32 = 1 ) type Params types.Params @@ -113,6 +113,12 @@ type Set[T comparable] struct { slice []T } +func (s *Set[T]) Copy() *Set[T] { + ret := NewSet[T](s.Length()) + ret.slice = append(ret.slice, s.slice...) + return ret +} + func (s *Set[T]) Add(value T) bool { if len(s.slice) == s.size { return false @@ -147,7 +153,7 @@ func NewSet[T comparable](length int) *Set[T] { } func ExceedsThreshold(power *big.Int, totalPower *big.Int) bool { - return new(big.Int).Mul(power, big.NewInt(ThresholdB)).Cmp(new(big.Int).Mul(totalPower, big.NewInt(ThresholdA))) > 0 + return new(big.Int).Mul(power, big.NewInt(int64(ThresholdB))).Cmp(new(big.Int).Mul(totalPower, big.NewInt(int64(ThresholdA)))) > 0 } type BigIntList []*big.Int diff --git a/x/oracle/keeper/msg_server_create_price.go b/x/oracle/keeper/msg_server_create_price.go index e41b429d7..decd1aa79 100644 --- a/x/oracle/keeper/msg_server_create_price.go +++ b/x/oracle/keeper/msg_server_create_price.go @@ -28,24 +28,26 @@ func (ms msgServer) CreatePrice(goCtx context.Context, msg *types.MsgCreatePrice ), ) - if caches != nil { - if newItem != nil { - ms.AppendPriceTR(ctx, newItem.TokenID, newItem.PriceTR) - - logger.Info("final price aggregation done", "feederID", msg.FeederID, "roundID", newItem.PriceTR.RoundID, "price", newItem.PriceTR.Price) - - ctx.EventManager().EmitEvent(sdk.NewEvent( - types.EventTypeCreatePrice, - sdk.NewAttribute(types.AttributeKeyFeederID, strconv.FormatUint(msg.FeederID, 10)), - sdk.NewAttribute(types.AttributeKeyRoundID, strconv.FormatUint(newItem.PriceTR.RoundID, 10)), - sdk.NewAttribute(types.AttributeKeyFinalPrice, newItem.PriceTR.Price), - sdk.NewAttribute(types.AttributeKeyPriceUpdated, types.AttributeValuePriceUpdatedSuccess), - ), - ) + if caches == nil { + return &types.MsgCreatePriceResponse{}, nil + } + if newItem != nil { + ms.AppendPriceTR(ctx, newItem.TokenID, newItem.PriceTR) + + logger.Info("final price aggregation done", "feederID", msg.FeederID, "roundID", newItem.PriceTR.RoundID, "price", newItem.PriceTR.Price) + + ctx.EventManager().EmitEvent(sdk.NewEvent( + types.EventTypeCreatePrice, + sdk.NewAttribute(types.AttributeKeyFeederID, strconv.FormatUint(msg.FeederID, 10)), + sdk.NewAttribute(types.AttributeKeyRoundID, strconv.FormatUint(newItem.PriceTR.RoundID, 10)), + sdk.NewAttribute(types.AttributeKeyFinalPrice, newItem.PriceTR.Price), + sdk.NewAttribute(types.AttributeKeyPriceUpdated, types.AttributeValuePriceUpdatedSuccess)), + ) + if !ctx.IsCheckTx() { cs.RemoveCache(caches) - } else { - cs.AddCache(caches) } + } else if !ctx.IsCheckTx() { + cs.AddCache(caches) } return &types.MsgCreatePriceResponse{}, nil diff --git a/x/oracle/keeper/msg_server_create_price_test.go b/x/oracle/keeper/msg_server_create_price_test.go index 47e53ffae..b806f8750 100644 --- a/x/oracle/keeper/msg_server_create_price_test.go +++ b/x/oracle/keeper/msg_server_create_price_test.go @@ -31,9 +31,6 @@ var _ = Describe("MsgCreatePrice", func() { Expect(ks.ms).ToNot(BeNil()) validatorC := NewMockValidatorI(ks.ctrl) - validatorC.EXPECT().GetBondedTokens().Return(math.NewInt(1)) - validatorC.EXPECT().GetBondedTokens().Return(math.NewInt(1)) - validatorC.EXPECT().GetBondedTokens().Return(math.NewInt(1)) validatorC.EXPECT().GetConsensusPower(gomock.Any()).Return(int64(1)) validatorC.EXPECT().GetConsensusPower(gomock.Any()).Return(int64(1)) diff --git a/x/oracle/keeper/prices.go b/x/oracle/keeper/prices.go index 804357d8e..871323e81 100644 --- a/x/oracle/keeper/prices.go +++ b/x/oracle/keeper/prices.go @@ -94,6 +94,7 @@ func (k Keeper) GetAllPrices(ctx sdk.Context) (list []types.Prices) { func (k Keeper) AppendPriceTR(ctx sdk.Context, tokenID uint64, priceTR types.PriceTimeRound) { nextRoundID := k.GetNextRoundID(ctx, tokenID) if nextRoundID != priceTR.RoundID { + // TODO: return error to tell this round adding fail return } store := k.getPriceTRStore(ctx, tokenID) diff --git a/x/oracle/keeper/query_prices.go b/x/oracle/keeper/query_prices.go index 504f4d9d5..2eb0a2a71 100644 --- a/x/oracle/keeper/query_prices.go +++ b/x/oracle/keeper/query_prices.go @@ -54,3 +54,5 @@ func (k Keeper) Prices(goCtx context.Context, req *types.QueryGetPricesRequest) return &types.QueryGetPricesResponse{Prices: val}, nil } + +// TODO: LatestPrice(tokenID) diff --git a/x/oracle/keeper/single.go b/x/oracle/keeper/single.go index 842eb2009..927a55fb5 100644 --- a/x/oracle/keeper/single.go +++ b/x/oracle/keeper/single.go @@ -13,7 +13,7 @@ import ( var cs *cache.Cache -var agc *aggregator.AggregatorContext +var agc, agcCheckTx *aggregator.AggregatorContext func GetCaches() *cache.Cache { if cs != nil { @@ -25,6 +25,24 @@ func GetCaches() *cache.Cache { // GetAggregatorContext returns singleton aggregatorContext used to calculate final price for each round of each tokenFeeder func GetAggregatorContext(ctx sdk.Context, k Keeper) *aggregator.AggregatorContext { + if ctx.IsCheckTx() { + if agcCheckTx != nil { + return agcCheckTx + } + if agc == nil { + c := GetCaches() + c.ResetCaches() + agcCheckTx = aggregator.NewAggregatorContext() + if ok := recacheAggregatorContext(ctx, agcCheckTx, k, c); !ok { + // this is the very first time oracle has been started, fill relalted info as initialization + initAggregatorContext(ctx, agcCheckTx, k, c) + } + return agcCheckTx + } + agcCheckTx = agc.Copy4CheckTx() + return agcCheckTx + } + if agc != nil { return agc } @@ -43,7 +61,7 @@ func GetAggregatorContext(ctx sdk.Context, k Keeper) *aggregator.AggregatorConte } func recacheAggregatorContext(ctx sdk.Context, agc *aggregator.AggregatorContext, k Keeper, c *cache.Cache) bool { - from := ctx.BlockHeight() - common.MaxNonce + from := ctx.BlockHeight() - int64(common.MaxNonce) to := ctx.BlockHeight() - 1 h, ok := k.GetValidatorUpdateBlock(ctx) @@ -60,8 +78,8 @@ func recacheAggregatorContext(ctx sdk.Context, agc *aggregator.AggregatorContext totalPower := big.NewInt(0) validatorPowers := make(map[string]*big.Int) k.IterateBondedValidatorsByPower(ctx, func(_ int64, validator stakingtypes.ValidatorI) bool { - power := big.NewInt(validator.GetConsensusPower(validator.GetBondedTokens())) - addr := string(validator.GetOperator()) + power := big.NewInt(validator.GetConsensusPower(sdk.DefaultPowerReduction)) + addr := validator.GetOperator().String() validatorPowers[addr] = power totalPower = new(big.Int).Add(totalPower, power) return false @@ -85,6 +103,7 @@ func recacheAggregatorContext(ctx sdk.Context, agc *aggregator.AggregatorContext pTmp = common.Params(*recentParams) agc.SetParams(&pTmp) prev = b + setCommonParams(*recentParams) } } @@ -104,9 +123,25 @@ func recacheAggregatorContext(ctx sdk.Context, agc *aggregator.AggregatorContext agc.SealRound(ctx, false) } - // fill params cache - c.AddCache(cache.ItemP(&pTmp)) + if from >= to { + // backwards compatible for that the validatorUpdateBlock updated every block + prev := int64(0) + for b, p := range recentParamsMap { + if b > prev { + // pTmp be set at least once, since len(recentParamsMap)>0 + pTmp = common.Params(*p) + prev = b + } + } + agc.SetParams(&pTmp) + setCommonParams(types.Params(pTmp)) + } + var pRet common.Params + if updated := c.GetCache(cache.ItemP(&pRet)); !updated { + c.AddCache(cache.ItemP(&pTmp)) + } + // fill params cache agc.PrepareRound(ctx, uint64(to)) return true @@ -119,11 +154,11 @@ func initAggregatorContext(ctx sdk.Context, agc *aggregator.AggregatorContext, k agc.SetParams(&pTmp) // set params cache c.AddCache(cache.ItemP(&pTmp)) - + setCommonParams(p) totalPower := big.NewInt(0) validatorPowers := make(map[string]*big.Int) k.IterateBondedValidatorsByPower(ctx, func(_ int64, validator stakingtypes.ValidatorI) bool { - power := big.NewInt(validator.GetConsensusPower(validator.GetBondedTokens())) + power := big.NewInt(validator.GetConsensusPower(sdk.DefaultPowerReduction)) addr := validator.GetOperator().String() validatorPowers[addr] = power totalPower = new(big.Int).Add(totalPower, power) @@ -144,3 +179,15 @@ func ResetAggregatorContext() { func ResetCache() { cs = nil } + +func ResetAggregatorContextCheckTx() { + agcCheckTx = nil +} + +func setCommonParams(p types.Params) { + common.MaxNonce = p.MaxNonce + common.ThresholdA = p.ThresholdA + common.ThresholdB = p.ThresholdB + common.MaxDetID = p.MaxDetId + common.Mode = p.Mode +} diff --git a/x/oracle/module.go b/x/oracle/module.go index 2c4196906..b6c1b83d8 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -215,7 +215,9 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val logger.Info("prepare for next oracle round of each tokenFeeder") agc.PrepareRound(ctx, 0) + keeper.ResetAggregatorContextCheckTx() + // TODO: update params happened during this block for cache, for the case: agc is recached from history and cache'params is set with the latest params by recache, but parmas changed during this block as well. or force agc to be GET first before cache be GET(later approch is better) cs.CommitCache(ctx, false, am.keeper) return []abci.ValidatorUpdate{} } diff --git a/x/oracle/types/info.pb.go b/x/oracle/types/info.pb.go index 6fff3844c..a1dbb24c9 100644 --- a/x/oracle/types/info.pb.go +++ b/x/oracle/types/info.pb.go @@ -90,6 +90,8 @@ type Token struct { Decimal int32 `protobuf:"varint,4,opt,name=decimal,proto3" json:"decimal,omitempty"` // set false when we stop official price oracle service for a specified token Active bool `protobuf:"varint,5,opt,name=active,proto3" json:"active,omitempty"` + // refer to assetID from assets module if exists + AssetID string `protobuf:"bytes,6,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` } func (m *Token) Reset() { *m = Token{} } @@ -160,6 +162,13 @@ func (m *Token) GetActive() bool { return false } +func (m *Token) GetAssetID() string { + if m != nil { + return m.AssetID + } + return "" +} + // Endpoint tells where to fetch the price info type Endpoint struct { // url int refer to TokenList.ID, 0 reprents default for all (as fall back) @@ -302,35 +311,36 @@ func init() { func init() { proto.RegisterFile("exocore/oracle/info.proto", fileDescriptor_a9bbae837d8caf59) } var fileDescriptor_a9bbae837d8caf59 = []byte{ - // 443 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0x6e, 0x13, 0x41, - 0x10, 0x86, 0xbd, 0xb6, 0xcf, 0x3e, 0xc6, 0x04, 0xa2, 0x55, 0x84, 0x0e, 0x17, 0x87, 0x65, 0x41, - 0x64, 0x9a, 0x3b, 0x14, 0x1a, 0x14, 0x0a, 0x84, 0xc1, 0x45, 0x28, 0x40, 0x5a, 0xa8, 0x68, 0xa2, - 0xcb, 0xee, 0xd8, 0x59, 0xd9, 0xde, 0xb5, 0xf6, 0xd6, 0x21, 0x7e, 0x83, 0x94, 0x3c, 0x02, 0x8f, - 0x43, 0x99, 0x92, 0x0a, 0xa1, 0xf3, 0x8b, 0xa0, 0xdb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0xd2, 0x51, 0xff, 0x02, 0x00, 0x00, + // 460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x31, 0x6f, 0x13, 0x31, + 0x14, 0x8e, 0x93, 0x5c, 0x72, 0xbc, 0x50, 0xa8, 0xac, 0x0a, 0x1d, 0x19, 0x8e, 0x28, 0x82, 0x2a, + 0x2c, 0x77, 0xa8, 0x2c, 0xa8, 0x0c, 0xa8, 0x81, 0x0c, 0x61, 0x00, 0xe9, 0x60, 0x62, 0xa9, 0xae, + 0xf6, 0x4b, 0x6a, 0x25, 0xb1, 0x23, 0x9f, 0x53, 0x9a, 0x7f, 0xd0, 0x91, 0x9f, 0xd5, 0xb1, 0x23, + 0x13, 0x42, 0xc9, 0x1f, 0x41, 0xb6, 0xef, 0x50, 0x23, 0xb5, 0x43, 0xb7, 0xf7, 0xbe, 0xef, 0x7d, + 0x9f, 0xbf, 0xf3, 0x3b, 0xc3, 0x73, 0xbc, 0x54, 0x4c, 0x69, 0x4c, 0x95, 0xce, 0xd9, 0x1c, 0x53, + 0x21, 0x27, 0x2a, 0x59, 0x6a, 0x65, 0x14, 0x7d, 0x52, 0x52, 0x89, 0xa7, 0xba, 0x07, 0x53, 0x35, + 0x55, 0x8e, 0x4a, 0x6d, 0xe5, 0xa7, 0xfa, 0x29, 0x04, 0x1f, 0xcf, 0x73, 0x21, 0x29, 0x85, 0xa6, + 0xcc, 0x17, 0x18, 0x91, 0x1e, 0x19, 0x3c, 0xca, 0x5c, 0x6d, 0x31, 0x8e, 0x05, 0x8b, 0xea, 0x1e, + 0xb3, 0x75, 0xff, 0x9a, 0x40, 0xf0, 0x5d, 0xcd, 0xf0, 0x6e, 0xc5, 0x21, 0x84, 0xcc, 0xda, 0x9d, + 0x0a, 0xee, 0x54, 0xcd, 0x61, 0x67, 0xf3, 0xe7, 0x45, 0xdb, 0x1d, 0x31, 0xfe, 0x94, 0xb5, 0x1d, + 0x39, 0xe6, 0xf4, 0x35, 0xec, 0x33, 0x25, 0x8d, 0xce, 0x99, 0x39, 0xcd, 0x39, 0xd7, 0x58, 0x14, + 0x51, 0xc3, 0xf9, 0x3c, 0xad, 0xf0, 0x13, 0x0f, 0xd3, 0x08, 0xda, 0x1c, 0x99, 0x58, 0xe4, 0xf3, + 0xa8, 0xd9, 0x23, 0x83, 0x20, 0xab, 0x5a, 0xfa, 0x0c, 0x5a, 0x39, 0x33, 0xe2, 0x02, 0xa3, 0xa0, + 0x47, 0x06, 0x61, 0x56, 0x76, 0x36, 0x44, 0x5e, 0x14, 0x68, 0x6c, 0x88, 0x96, 0x35, 0xf5, 0x21, + 0x4e, 0x2c, 0x66, 0x43, 0x38, 0x72, 0xcc, 0xfb, 0x57, 0x75, 0x08, 0x47, 0x92, 0x2f, 0x95, 0x90, + 0x86, 0x0e, 0x21, 0x54, 0x93, 0x89, 0xcb, 0x17, 0x91, 0x5e, 0x63, 0xd0, 0x39, 0x3a, 0x4c, 0x76, + 0x6f, 0x30, 0xa9, 0x66, 0x93, 0xaf, 0xe5, 0xe0, 0x48, 0x1a, 0xbd, 0xce, 0xfe, 0xeb, 0xe8, 0x07, + 0x68, 0x2b, 0xe9, 0x2d, 0xea, 0xce, 0xe2, 0xd5, 0xfd, 0x16, 0xf2, 0x96, 0x43, 0xa5, 0xea, 0xbe, + 0x87, 0xbd, 0x1d, 0x6f, 0xba, 0x0f, 0x8d, 0x19, 0xae, 0xdd, 0x15, 0x37, 0x33, 0x5b, 0xd2, 0x03, + 0x08, 0x2e, 0xf2, 0xf9, 0x0a, 0xcb, 0xa5, 0xf8, 0xe6, 0xb8, 0xfe, 0x8e, 0x74, 0x8f, 0xe1, 0xf1, + 0x6d, 0xd7, 0x87, 0x68, 0xfb, 0x57, 0x04, 0x5a, 0xdf, 0xd4, 0x4a, 0x33, 0xbc, 0x73, 0xad, 0x09, + 0x04, 0x68, 0x3d, 0x9d, 0xb0, 0x73, 0x14, 0xdd, 0xf7, 0x59, 0x99, 0x1f, 0x2b, 0x0f, 0x12, 0xdc, + 0xed, 0x34, 0xcc, 0x7c, 0x43, 0x5f, 0xc2, 0x1e, 0x47, 0x83, 0x7a, 0x21, 0xa4, 0x28, 0x8c, 0x60, + 0x6e, 0x9f, 0x61, 0xb6, 0x0b, 0x0e, 0x3f, 0x5f, 0x6f, 0x62, 0x72, 0xb3, 0x89, 0xc9, 0xdf, 0x4d, + 0x4c, 0x7e, 0x6d, 0xe3, 0xda, 0xcd, 0x36, 0xae, 0xfd, 0xde, 0xc6, 0xb5, 0x1f, 0x6f, 0xa6, 0xc2, + 0x9c, 0xaf, 0xce, 0x12, 0xa6, 0x16, 0xe9, 0xc8, 0x07, 0xf8, 0x82, 0xe6, 0xa7, 0xd2, 0xb3, 0xb4, + 0x7a, 0x06, 0x97, 0xd5, 0x43, 0x30, 0xeb, 0x25, 0x16, 0x67, 0x2d, 0xf7, 0x93, 0xbf, 0xfd, 0x17, + 0x00, 0x00, 0xff, 0xff, 0xa7, 0x81, 0x0b, 0x3b, 0x27, 0x03, 0x00, 0x00, } func (m *Chain) Marshal() (dAtA []byte, err error) { @@ -390,6 +400,13 @@ func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintInfo(dAtA, i, uint64(len(m.AssetID))) + i-- + dAtA[i] = 0x32 + } if m.Active { i-- if m.Active { @@ -597,6 +614,10 @@ func (m *Token) Size() (n int) { if m.Active { n += 2 } + l = len(m.AssetID) + if l > 0 { + n += 1 + l + sovInfo(uint64(l)) + } return n } @@ -919,6 +940,38 @@ func (m *Token) Unmarshal(dAtA []byte) error { } } m.Active = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AssetID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipInfo(dAtA[iNdEx:]) diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index b8df75516..07e1d7e21 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -40,6 +40,7 @@ func DefaultParams() Params { ContractAddress: "0x", Decimal: 18, Active: true, + AssetID: "", }, }, Sources: []*Source{ @@ -73,6 +74,11 @@ func DefaultParams() Params { Interval: 10, }, }, + MaxNonce: 3, + ThresholdA: 2, + ThresholdB: 3, + Mode: 1, + MaxDetId: 5, } } diff --git a/x/oracle/types/params.pb.go b/x/oracle/types/params.pb.go index ab6cad371..a5eb2565e 100644 --- a/x/oracle/types/params.pb.go +++ b/x/oracle/types/params.pb.go @@ -35,6 +35,16 @@ type Params struct { Rules []*RuleSource `protobuf:"bytes,4,rep,name=rules,proto3" json:"rules,omitempty"` // each tokenFeeder represents an active token whose price being updated TokenFeeders []*TokenFeeder `protobuf:"bytes,5,rep,name=token_feeders,json=tokenFeeders,proto3" json:"token_feeders,omitempty"` + // for each round allow at most max_nonce transactions to be sent by one validator, [1,max_nonce] + MaxNonce int32 `protobuf:"varint,6,opt,name=max_nonce,json=maxNonce,proto3" json:"max_nonce,omitempty"` + // voting power need to reach more than threshold_a/threshold_b + ThresholdA int32 `protobuf:"varint,7,opt,name=threshold_a,json=thresholdA,proto3" json:"threshold_a,omitempty"` + // voting power need to reach more than threshold_a/threshold_b + ThresholdB int32 `protobuf:"varint,8,opt,name=threshold_b,json=thresholdB,proto3" json:"threshold_b,omitempty"` + // for v1, mode=1, get final price as soon as voting power reach threshold_a/threshold_b + Mode int32 `protobuf:"varint,9,opt,name=mode,proto3" json:"mode,omitempty"` + // for each round, a validator only allowed to provide at most max_det_id continuos rounds of prices from deterministic source + MaxDetId int32 `protobuf:"varint,10,opt,name=max_det_id,json=maxDetId,proto3" json:"max_det_id,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -104,6 +114,41 @@ func (m *Params) GetTokenFeeders() []*TokenFeeder { return nil } +func (m *Params) GetMaxNonce() int32 { + if m != nil { + return m.MaxNonce + } + return 0 +} + +func (m *Params) GetThresholdA() int32 { + if m != nil { + return m.ThresholdA + } + return 0 +} + +func (m *Params) GetThresholdB() int32 { + if m != nil { + return m.ThresholdB + } + return 0 +} + +func (m *Params) GetMode() int32 { + if m != nil { + return m.Mode + } + return 0 +} + +func (m *Params) GetMaxDetId() int32 { + if m != nil { + return m.MaxDetId + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "exocore.oracle.Params") } @@ -111,26 +156,31 @@ func init() { func init() { proto.RegisterFile("exocore/oracle/params.proto", fileDescriptor_ba212ceb89f5e6b2) } var fileDescriptor_ba212ceb89f5e6b2 = []byte{ - // 296 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0xc8, 0x4f, - 0xce, 0x2f, 0x4a, 0xd5, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, - 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xea, 0x41, 0x24, 0xa5, 0x24, - 0xd1, 0x14, 0x67, 0xe6, 0xa5, 0xe5, 0x43, 0x94, 0x4a, 0x29, 0xa2, 0x49, 0x95, 0xe4, 0x67, 0xa7, - 0xe6, 0xc5, 0xa7, 0xa5, 0xa6, 0xa6, 0xa4, 0x16, 0x41, 0x95, 0x88, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, - 0x99, 0xfa, 0x20, 0x16, 0x44, 0x54, 0x69, 0x12, 0x13, 0x17, 0x5b, 0x00, 0xd8, 0x52, 0x21, 0x5d, - 0x2e, 0xb6, 0xe4, 0x8c, 0xc4, 0xcc, 0xbc, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x51, - 0x3d, 0x54, 0xfb, 0xf5, 0x9c, 0x41, 0xb2, 0x41, 0x50, 0x45, 0x20, 0xe5, 0x60, 0x5b, 0x8a, 0x25, - 0x98, 0xb0, 0x2b, 0x0f, 0x01, 0xc9, 0x06, 0x41, 0x15, 0x09, 0x19, 0x70, 0xb1, 0x17, 0xe7, 0x97, - 0x16, 0x25, 0xa7, 0x16, 0x4b, 0x30, 0x83, 0xd5, 0x8b, 0xa1, 0xab, 0x0f, 0x06, 0x4b, 0x07, 0xc1, - 0x94, 0x09, 0x19, 0x70, 0xb1, 0x16, 0x95, 0xe6, 0xa4, 0x16, 0x4b, 0xb0, 0x80, 0xd5, 0x4b, 0xa1, - 0xab, 0x0f, 0x2a, 0xcd, 0x49, 0x85, 0xea, 0x81, 0x28, 0x14, 0x72, 0xe0, 0xe2, 0x45, 0xf6, 0x78, - 0xb1, 0x04, 0x2b, 0x58, 0xa7, 0x34, 0x56, 0x97, 0xb9, 0x81, 0xd5, 0x04, 0xf1, 0x94, 0x20, 0x38, - 0xc5, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0x79, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, - 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, - 0xb1, 0x1c, 0x43, 0x94, 0x41, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, - 0x2b, 0xc4, 0x50, 0xbf, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x58, 0x0c, 0x54, 0xc0, 0xe3, - 0xa0, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0xce, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x77, 0xaa, 0x84, 0x42, 0xea, 0x01, 0x00, 0x00, + // 377 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0xd2, 0x3f, 0x6f, 0xe2, 0x30, + 0x18, 0x06, 0xf0, 0xe4, 0x80, 0x00, 0xe6, 0xee, 0x06, 0xeb, 0xee, 0xe4, 0x83, 0x53, 0xe0, 0x3a, + 0xb1, 0x34, 0x41, 0xed, 0xd6, 0xa9, 0xa5, 0x7f, 0xa4, 0x76, 0x40, 0x55, 0xda, 0xa9, 0x4b, 0x14, + 0x92, 0x17, 0x12, 0x91, 0xc4, 0xc8, 0x76, 0xd4, 0xf4, 0x5b, 0x74, 0xec, 0x58, 0xa9, 0x5f, 0xa6, + 0x23, 0x63, 0xc7, 0x0a, 0xbe, 0x48, 0x15, 0x27, 0xd0, 0x12, 0xb1, 0xbd, 0xf6, 0xf3, 0xb3, 0x9e, + 0x58, 0x31, 0xea, 0x40, 0x4a, 0x5d, 0xca, 0xc0, 0xa4, 0xcc, 0x71, 0x43, 0x30, 0xe7, 0x0e, 0x73, + 0x22, 0x6e, 0xcc, 0x19, 0x15, 0x14, 0xff, 0x2c, 0x42, 0x23, 0x0f, 0xdb, 0x7f, 0x4b, 0x38, 0x88, + 0x27, 0x34, 0xa7, 0xed, 0xff, 0xa5, 0x48, 0xd0, 0x19, 0xc4, 0xf6, 0x04, 0xc0, 0x03, 0x56, 0x90, + 0x5f, 0x53, 0x3a, 0xa5, 0x72, 0x34, 0xb3, 0x29, 0xdf, 0xdd, 0x7b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fa, 0xb8, 0xd2, 0x95, 0xc5, 0x4a, 0x57, 0xde, 0x56, 0xba, 0x72, 0x37, 0x98, 0x06, 0xc2, 0x4f, + 0xc6, 0x86, 0x4b, 0x23, 0xf3, 0x3c, 0xbf, 0xe5, 0x08, 0xc4, 0x3d, 0x65, 0x33, 0x73, 0xfd, 0x24, + 0xd2, 0xcd, 0xa3, 0x78, 0x98, 0x03, 0x1f, 0x6b, 0xf2, 0xc7, 0x1f, 0x7e, 0x04, 0x00, 0x00, 0xff, + 0xff, 0x5a, 0xbc, 0x18, 0xa5, 0x7b, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -153,6 +203,31 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MaxDetId != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxDetId)) + i-- + dAtA[i] = 0x50 + } + if m.Mode != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.Mode)) + i-- + dAtA[i] = 0x48 + } + if m.ThresholdB != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ThresholdB)) + i-- + dAtA[i] = 0x40 + } + if m.ThresholdA != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ThresholdA)) + i-- + dAtA[i] = 0x38 + } + if m.MaxNonce != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxNonce)) + i-- + dAtA[i] = 0x30 + } if len(m.TokenFeeders) > 0 { for iNdEx := len(m.TokenFeeders) - 1; iNdEx >= 0; iNdEx-- { { @@ -273,6 +348,21 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } + if m.MaxNonce != 0 { + n += 1 + sovParams(uint64(m.MaxNonce)) + } + if m.ThresholdA != 0 { + n += 1 + sovParams(uint64(m.ThresholdA)) + } + if m.ThresholdB != 0 { + n += 1 + sovParams(uint64(m.ThresholdB)) + } + if m.Mode != 0 { + n += 1 + sovParams(uint64(m.Mode)) + } + if m.MaxDetId != 0 { + n += 1 + sovParams(uint64(m.MaxDetId)) + } return n } @@ -481,6 +571,101 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxNonce", wireType) + } + m.MaxNonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxNonce |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ThresholdA", wireType) + } + m.ThresholdA = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ThresholdA |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ThresholdB", wireType) + } + m.ThresholdB = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ThresholdB |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + 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 ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Mode |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDetId", wireType) + } + m.MaxDetId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxDetId |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])