diff --git a/.changelog/unreleased/bug-fixes/1921-write-stderr.md b/.changelog/unreleased/bug-fixes/1921-write-stderr.md new file mode 100644 index 0000000000..665ef78024 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1921-write-stderr.md @@ -0,0 +1,2 @@ +- Write unbonding period advisory to stderr instead of stdout + ([\#1921](https://github.com/cosmos/interchain-security/pull/1921)) \ No newline at end of file diff --git a/.changelog/unreleased/bug-fixes/provider/1925-apply-audit-suggestions.md b/.changelog/unreleased/bug-fixes/provider/1925-apply-audit-suggestions.md new file mode 100644 index 0000000000..3d12033a4e --- /dev/null +++ b/.changelog/unreleased/bug-fixes/provider/1925-apply-audit-suggestions.md @@ -0,0 +1,3 @@ +- Apply audit suggestions that include a bug fix in the way we compute the + maximum capped power. ([\#1925](https://github.com/cosmos/interchain- + security/pull/1925)) diff --git a/.changelog/unreleased/dependencies/1924-bump-ibc.md b/.changelog/unreleased/dependencies/1924-bump-ibc.md new file mode 100644 index 0000000000..8980dd3b9a --- /dev/null +++ b/.changelog/unreleased/dependencies/1924-bump-ibc.md @@ -0,0 +1,3 @@ +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.5.1](https://github.com/cosmos/ibc-go/releases/tag/v7.5.1). + ([\#1924](https://github.com/cosmos/interchain-security/pull/1924)) \ No newline at end of file diff --git a/.changelog/unreleased/state-breaking/provider/1925-apply-audit-suggestions.md b/.changelog/unreleased/state-breaking/provider/1925-apply-audit-suggestions.md new file mode 100644 index 0000000000..3d12033a4e --- /dev/null +++ b/.changelog/unreleased/state-breaking/provider/1925-apply-audit-suggestions.md @@ -0,0 +1,3 @@ +- Apply audit suggestions that include a bug fix in the way we compute the + maximum capped power. ([\#1925](https://github.com/cosmos/interchain- + security/pull/1925)) diff --git a/.changelog/v4.2.0/api-breaking/provider/1732-assigning-already-assigned-key-fix.md b/.changelog/v4.2.0/api-breaking/provider/1732-assigning-already-assigned-key-fix.md new file mode 100644 index 0000000000..667a481d3f --- /dev/null +++ b/.changelog/v4.2.0/api-breaking/provider/1732-assigning-already-assigned-key-fix.md @@ -0,0 +1,2 @@ +- Assigning a key that is already assigned by the same validator will now be a no-op instead of throwing an error. + ([\#1732](https://github.com/cosmos/interchain-security/pull/1732)) \ No newline at end of file diff --git a/.changelog/v4.2.0/api-breaking/provider/1863-add-minimum-power-in-topN-to-consumer-chain-list.md b/.changelog/v4.2.0/api-breaking/provider/1863-add-minimum-power-in-topN-to-consumer-chain-list.md new file mode 100644 index 0000000000..482702f26b --- /dev/null +++ b/.changelog/v4.2.0/api-breaking/provider/1863-add-minimum-power-in-topN-to-consumer-chain-list.md @@ -0,0 +1,2 @@ +- Changes the `list-consumer-chains` query to include a `min_power_in_top_N` field, as well as fields for all power shaping parameters of the consumer. + ([\#1863](https://github.com/cosmos/interchain-security/pull/1863)) \ No newline at end of file diff --git a/.changelog/v4.2.0/dependencies/1876-bump-comet.md b/.changelog/v4.2.0/dependencies/1876-bump-comet.md new file mode 100644 index 0000000000..aed8c4f155 --- /dev/null +++ b/.changelog/v4.2.0/dependencies/1876-bump-comet.md @@ -0,0 +1,3 @@ +- Bump [CometBFT](https://github.com/cometbft/cometbft) to + [v0.37.6](https://github.com/cometbft/cometbft/releases/tag/v0.37.6). + ([\#1876](https://github.com/cosmos/interchain-security/pull/1876)) \ No newline at end of file diff --git a/.changelog/v4.2.0/dependencies/1876-bump-sdk.md b/.changelog/v4.2.0/dependencies/1876-bump-sdk.md new file mode 100644 index 0000000000..8f18db0eca --- /dev/null +++ b/.changelog/v4.2.0/dependencies/1876-bump-sdk.md @@ -0,0 +1,3 @@ +- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.11). + ([\#1876](https://github.com/cosmos/interchain-security/pull/1876)) \ No newline at end of file diff --git a/.changelog/v4.2.0/features/provider/1587-enable-opt-in-chains-through-gov-proposals.md b/.changelog/v4.2.0/features/provider/1587-enable-opt-in-chains-through-gov-proposals.md new file mode 100644 index 0000000000..57f16adc9b --- /dev/null +++ b/.changelog/v4.2.0/features/provider/1587-enable-opt-in-chains-through-gov-proposals.md @@ -0,0 +1,2 @@ +- Enable Opt In and Top N chains through gov proposals. + ([\#1587](https://github.com/cosmos/interchain-security/pull/1587)) \ No newline at end of file diff --git a/.changelog/v4.2.0/features/provider/1809-pss.md b/.changelog/v4.2.0/features/provider/1809-pss.md new file mode 100644 index 0000000000..f7a235c5be --- /dev/null +++ b/.changelog/v4.2.0/features/provider/1809-pss.md @@ -0,0 +1,3 @@ +- Adding the Partial Set Security (PSS) feature cf. [ADR 015](https://cosmos.github.io/interchain-security/adrs/adr-015-partial-set-security). + PSS enables consumer chains to join ICS as _Top N_ or _Opt In_ chains and enables validators to opt to validate the consumer chains they want. + ([\#1809](https://github.com/cosmos/interchain-security/pull/1809)) \ No newline at end of file diff --git a/.changelog/v4.2.0/features/provider/1830-introduce-power-shaping.md b/.changelog/v4.2.0/features/provider/1830-introduce-power-shaping.md new file mode 100644 index 0000000000..87cd4590b4 --- /dev/null +++ b/.changelog/v4.2.0/features/provider/1830-introduce-power-shaping.md @@ -0,0 +1,2 @@ +- Introduce power-shaping features for consumer chains. The features: (i) allow us to cap the total number of validators that can validate the consumer chain, (ii) set a cap on the maximum voting power (percentage-wise) a validator can have on a consumer chain, and (iii) introduce allowlist and denylists to restrict which validators are allowed or not to validate a consumer chain. + ([\#1830](https://github.com/cosmos/interchain-security/pull/1830)) \ No newline at end of file diff --git a/.changelog/v4.2.0/features/provider/1863-add-minimum-power-in-topN-to-consumer-chain-list.md b/.changelog/v4.2.0/features/provider/1863-add-minimum-power-in-topN-to-consumer-chain-list.md new file mode 100644 index 0000000000..482702f26b --- /dev/null +++ b/.changelog/v4.2.0/features/provider/1863-add-minimum-power-in-topN-to-consumer-chain-list.md @@ -0,0 +1,2 @@ +- Changes the `list-consumer-chains` query to include a `min_power_in_top_N` field, as well as fields for all power shaping parameters of the consumer. + ([\#1863](https://github.com/cosmos/interchain-security/pull/1863)) \ No newline at end of file diff --git a/.changelog/v4.2.0/features/provider/1867-add-query-for-latest-consumer-validator-set.md b/.changelog/v4.2.0/features/provider/1867-add-query-for-latest-consumer-validator-set.md new file mode 100644 index 0000000000..dc33ef69d0 --- /dev/null +++ b/.changelog/v4.2.0/features/provider/1867-add-query-for-latest-consumer-validator-set.md @@ -0,0 +1,2 @@ +- Introduces the `consumer-validators` query to retrieve the latest set consumer-validator set for a consumer chain. + ([\#1863](https://github.com/cosmos/interchain-security/pull/1867)) diff --git a/.changelog/v4.2.0/state-breaking/provider/1587-enable-opt-in-chains-through-gov-proposals.md b/.changelog/v4.2.0/state-breaking/provider/1587-enable-opt-in-chains-through-gov-proposals.md new file mode 100644 index 0000000000..57f16adc9b --- /dev/null +++ b/.changelog/v4.2.0/state-breaking/provider/1587-enable-opt-in-chains-through-gov-proposals.md @@ -0,0 +1,2 @@ +- Enable Opt In and Top N chains through gov proposals. + ([\#1587](https://github.com/cosmos/interchain-security/pull/1587)) \ No newline at end of file diff --git a/.changelog/v4.2.0/state-breaking/provider/1732-assigning-already-assigned-key-fix.md b/.changelog/v4.2.0/state-breaking/provider/1732-assigning-already-assigned-key-fix.md new file mode 100644 index 0000000000..667a481d3f --- /dev/null +++ b/.changelog/v4.2.0/state-breaking/provider/1732-assigning-already-assigned-key-fix.md @@ -0,0 +1,2 @@ +- Assigning a key that is already assigned by the same validator will now be a no-op instead of throwing an error. + ([\#1732](https://github.com/cosmos/interchain-security/pull/1732)) \ No newline at end of file diff --git a/.changelog/v4.2.0/state-breaking/provider/1809-pss.md b/.changelog/v4.2.0/state-breaking/provider/1809-pss.md new file mode 100644 index 0000000000..c0af9ae11e --- /dev/null +++ b/.changelog/v4.2.0/state-breaking/provider/1809-pss.md @@ -0,0 +1,2 @@ +- Adding the Partial Set Security feature cf. [ADR 015](https://cosmos.github.io/interchain-security/adrs/adr-015-partial-set-security). + ([\#1809](https://github.com/cosmos/interchain-security/pull/1809)) \ No newline at end of file diff --git a/.changelog/v4.2.0/state-breaking/provider/1830-introduce-power-shaping.md b/.changelog/v4.2.0/state-breaking/provider/1830-introduce-power-shaping.md new file mode 100644 index 0000000000..87cd4590b4 --- /dev/null +++ b/.changelog/v4.2.0/state-breaking/provider/1830-introduce-power-shaping.md @@ -0,0 +1,2 @@ +- Introduce power-shaping features for consumer chains. The features: (i) allow us to cap the total number of validators that can validate the consumer chain, (ii) set a cap on the maximum voting power (percentage-wise) a validator can have on a consumer chain, and (iii) introduce allowlist and denylists to restrict which validators are allowed or not to validate a consumer chain. + ([\#1830](https://github.com/cosmos/interchain-security/pull/1830)) \ No newline at end of file diff --git a/.changelog/v4.2.0/summary.md b/.changelog/v4.2.0/summary.md new file mode 100644 index 0000000000..d9bdda58b3 --- /dev/null +++ b/.changelog/v4.2.0/summary.md @@ -0,0 +1 @@ +May 17, 2024 diff --git a/.coderabbit.yml b/.coderabbit.yml new file mode 100644 index 0000000000..e89dfcdfcd --- /dev/null +++ b/.coderabbit.yml @@ -0,0 +1,41 @@ +language: "en" +early_access: false +reviews: + request_changes_workflow: false + high_level_summary: true + poem: false + review_status: false + collapse_walkthrough: true + path_filters: + - "!api/" + - "!docs/" + path_instructions: + - path: "**/*.go" + instructions: "Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations." + - path: "tests/e2e/*" + instructions: | + "Assess the e2e test code assessing sufficient code coverage for the changes associated in the pull request" + - path: "tests/integration/*" + instructions: | + "Assess the e2e test code assessing sufficient code coverage for the changes associated in the pull request" + - path: "**/*_test.go" + instructions: | + "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request" + - path: "**/*.md" + instructions: | + "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness. Please DO NOT report any missing or superfluous newlines, in particular at the end or beginning of files." + - path: ".changelog/*" + instructions: | + "Assess the changes in the changelog for correctness and completeness, particularly flagging missing changes" + auto_review: + enabled: true + ignore_title_keywords: + - "WIP" + - "DO NOT MERGE" + drafts: false + base_branches: + - "main" + - "feat/*" + - "release/*" +chat: + auto_reply: true diff --git a/.github/.codespellignore b/.github/.codespellignore index 3fc9037efb..0c7e0a95c1 100644 --- a/.github/.codespellignore +++ b/.github/.codespellignore @@ -1,3 +1,5 @@ clienta connectiona sover +optin +opt-in diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e588557500..0a55a2d111 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,7 +22,7 @@ updates: directory: "/" schedule: interval: daily - target-branch: "release/v2.0.x" + target-branch: "release/v4.1.x" # Only allow automated security-related dependency updates on release branches. open-pull-requests-limit: 0 labels: @@ -32,27 +32,7 @@ updates: directory: "/" schedule: interval: daily - target-branch: "release/v2.4.x-lsm" - # Only allow automated security-related dependency updates on release branches. - open-pull-requests-limit: 0 - labels: - - dependencies - - - package-ecosystem: gomod - directory: "/" - schedule: - interval: daily - target-branch: "release/v3.1.x" - # Only allow automated security-related dependency updates on release branches. - open-pull-requests-limit: 0 - labels: - - dependencies - - - package-ecosystem: gomod - directory: "/" - schedule: - interval: daily - target-branch: "release/v3.2.x" + target-branch: "release/v4.1.x-lsm" # Only allow automated security-related dependency updates on release branches. open-pull-requests-limit: 0 labels: @@ -62,7 +42,7 @@ updates: directory: "/" schedule: interval: daily - target-branch: "release/v3.3.x" + target-branch: "release/v4.2.x" # Only allow automated security-related dependency updates on release branches. open-pull-requests-limit: 0 labels: @@ -72,7 +52,7 @@ updates: directory: "/" schedule: interval: daily - target-branch: "release/v4.0.x" + target-branch: "release/v4.2.x-lsm" # Only allow automated security-related dependency updates on release branches. open-pull-requests-limit: 0 labels: @@ -82,18 +62,9 @@ updates: directory: "/" schedule: interval: daily - target-branch: "release/v4.1.x" + target-branch: "release/v5.x" # Only allow automated security-related dependency updates on release branches. open-pull-requests-limit: 0 labels: - dependencies - - package-ecosystem: gomod - directory: "/" - schedule: - interval: daily - target-branch: "release/v4.1.x-lsm" - # Only allow automated security-related dependency updates on release branches. - open-pull-requests-limit: 0 - labels: - - dependencies \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2150c8ac86..7a18604ac7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,7 +37,7 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" check-latest: true # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 8e36cd6cda..db8ecca694 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -37,10 +37,12 @@ jobs: - name: Build πŸ”§ run: | npm install -g npm@10.2.4 - make build-docs + cd docs + ./sync_versions.sh + ./build_deploy.sh - name: Deploy πŸš€ - uses: JamesIves/github-pages-deploy-action@v4.5.0 + uses: JamesIves/github-pages-deploy-action@v4.6.1 with: branch: gh-pages folder: ~/output diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 895ad0e4e3..bb9c86a3f9 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -57,7 +57,7 @@ jobs: # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} if: github.event_name != 'pull_request' - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a879de2114..02db4be638 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' - uses: technote-space/get-diff-action@v6.1.2 id: git_diff with: diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index 18027164fc..7c573d1647 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -17,7 +17,7 @@ jobs: statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v5.4.0 + - uses: amannn/action-semantic-pull-request@v5.5.2 id: lint_pr_title env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index ca560550ca..882fe0ecb0 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 with: fetch-depth: 0 # get all history for all branches and tags @@ -31,7 +31,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E compatibility test # Run compatibility tests for different consumer (-cv) and provider (-pv) versions. # Combination of all provider versions with consumer versions are tested. @@ -43,14 +43,14 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E happy-path test run: go run ./tests/e2e/... --tc happy-path changeover-test: @@ -59,14 +59,14 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E changeover test run: go run ./tests/e2e/... --tc changeover democracy-reward-test: @@ -75,14 +75,14 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E democracy-reward tests run: go run ./tests/e2e/... --tc democracy-reward democracy-test: @@ -91,14 +91,14 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E democracy tests run: go run ./tests/e2e/... --tc democracy slash-throttle-test: @@ -107,14 +107,14 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E slash-throttle tests run: go run ./tests/e2e/... --tc slash-throttle multiconsumer-test: @@ -123,14 +123,14 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E multi-consumer tests run: go run ./tests/e2e/... --tc multiconsumer consumer-misbehaviour-test: @@ -139,14 +139,14 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E consumer-misbehaviour tests run: go run ./tests/e2e/... --tc consumer-misbehaviour consumer-double-sign-test: @@ -155,14 +155,14 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E consumer-double-sign tests run: go run ./tests/e2e/... --tc consumer-double-sign consumer-double-downtime-test: @@ -171,16 +171,112 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - uses: actions/checkout@v4 - name: Checkout LFS objects run: git lfs checkout - name: Setup Go uses: actions/setup-go@v5 with: - go-version: "1.21" # The Go version to download (if necessary) and use. + go-version: "1.22" # The Go version to download (if necessary) and use. - name: E2E consumer-double-downtime tests run: go run ./tests/e2e/... --tc consumer-double-downtime + partial-set-security-opt-in-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" # The Go version to download (if necessary) and use. + - name: E2E partial set security opt-in chain + run: go run ./tests/e2e/... --tc partial-set-security-opt-in + partial-set-security-top-n-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" # The Go version to download (if necessary) and use. + - name: E2E partial set security Top N chain + run: go run ./tests/e2e/... --tc partial-set-security-top-n + partial-set-security-validator-set-cap-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" # The Go version to download (if necessary) and use. + - name: E2E partial set security validator-set cap + run: go run ./tests/e2e/... --tc partial-set-security-validator-set-cap + partial-set-security-validators-power-cap-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" # The Go version to download (if necessary) and use. + - name: E2E partial set security validators-power cap + run: go run ./tests/e2e/... --tc partial-set-security-validators-power-cap + partial-set-security-validators-allowlisted-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" # The Go version to download (if necessary) and use. + - name: E2E partial set security allowlist + run: go run ./tests/e2e/... --tc partial-set-security-validators-allowlisted + partial-set-security-validators-denylisted-test: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + - uses: actions/checkout@v4 + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" # The Go version to download (if necessary) and use. + - name: E2E partial set security denylist + run: go run ./tests/e2e/... --tc partial-set-security-validators-denylisted nightly-test-fail: needs: @@ -193,11 +289,17 @@ jobs: - consumer-misbehaviour-test - consumer-double-sign-test - consumer-double-downtime-test + - partial-set-security-opt-in-test + - partial-set-security-top-n-test + - partial-set-security-validator-set-cap-test + - partial-set-security-validators-power-cap-test + - partial-set-security-validators-allowlisted-test + - partial-set-security-validators-denylisted-test if: ${{ failure() }} runs-on: ubuntu-latest steps: - name: Notify Slack on failure - uses: slackapi/slack-github-action@v1.25.0 + uses: slackapi/slack-github-action@v1.26.0 env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/.github/workflows/proto-registry.yml b/.github/workflows/proto-registry.yml index 2f1385be33..0dd39a112c 100644 --- a/.github/workflows/proto-registry.yml +++ b/.github/workflows/proto-registry.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.30.1 + - uses: bufbuild/buf-setup-action@v1.32.2 - uses: bufbuild/buf-push-action@v1 with: input: "proto" diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 3c9d1b05b0..68f31f2b67 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bufbuild/buf-setup-action@v1.30.1 + - uses: bufbuild/buf-setup-action@v1.32.2 - uses: bufbuild/buf-breaking-action@v1 with: input: "proto" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 479be3c317..147ab7f60e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" check-latest: true cache: true cache-dependency-path: go.sum @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" check-latest: true cache: true cache-dependency-path: go.sum @@ -96,7 +96,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" check-latest: true cache: true cache-dependency-path: go.sum @@ -177,7 +177,7 @@ jobs: run: git lfs checkout - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" check-latest: true cache: true cache-dependency-path: go.sum @@ -208,7 +208,7 @@ jobs: run: git lfs checkout - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" check-latest: true cache: true cache-dependency-path: go.sum @@ -239,7 +239,7 @@ jobs: run: git lfs checkout - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" check-latest: true cache: true cache-dependency-path: go.sum diff --git a/.gitignore b/.gitignore index e83a69a504..96e3251977 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ vendor/ build/ .vscode .idea + +# docusaurus versioned docs created during build +docs/versioned_docs +docs/versioned_sidebars diff --git a/.mergify.yml b/.mergify.yml index 1c0a6bb81a..d373fe3fb9 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -10,67 +10,43 @@ queue_rules: - "#approved-reviews-by>1" pull_request_rules: - - name: Backport patches to the release/v2.0.x branch - conditions: - - base=main - - label=A:backport/v2.0.x - actions: - backport: - branches: - - release/v2.0.x - - name: Backport patches to the release/v2.4.x-lsm branch - conditions: - - base=main - - label=A:backport/v2.4.x-lsm - actions: - backport: - branches: - - release/v2.4.x-lsm - - name: Backport patches to the release/v3.1.x branch - conditions: - - base=main - - label=A:backport/v3.1.x - actions: - backport: - branches: - - release/v3.1.x - - name: Backport patches to the release/v3.2.x branch + - name: Backport patches to the release/v4.1.x branch conditions: - base=main - - label=A:backport/v3.2.x + - label=A:backport/v4.1.x actions: backport: branches: - - release/v3.2.x - - name: Backport patches to the release/v3.3.x branch + - release/v4.1.x + - name: Backport patches to the release/v4.1.x-lsm branch conditions: - base=main - - label=A:backport/v3.3.x + - label=A:backport/v4.1.x-lsm actions: backport: branches: - - release/v3.3.x - - name: Backport patches to the release/v4.0.x branch + - release/v4.1.x-lsm + - name: Backport patches to the release/v4.2.x branch conditions: - base=main - - label=A:backport/v4.0.x + - label=A:backport/v4.2.x actions: backport: branches: - - release/v4.0.x - - name: Backport patches to the release/v4.1.x branch + - release/v4.2.x + - name: Backport patches to the release/v4.2.x-lsm branch conditions: - base=main - - label=A:backport/v4.1.x + - label=A:backport/v4.2.x-lsm actions: backport: branches: - - release/v4.1.x - - name: Backport patches to the release/v4.1.x-lsm branch + - release/v4.2.x-lsm + - name: Backport patches to the release/v5.x branch conditions: - base=main - - label=A:backport/v4.1.x-lsm + - label=A:backport/v5.x actions: backport: branches: - - release/v4.1.x-lsm \ No newline at end of file + - release/v5.x diff --git a/CHANGELOG.md b/CHANGELOG.md index 893f65a76b..f909c24bfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## v5.0.0 +❗ *The provider module should never not be used with this version.* + *May 9, 2024* ### DEPENDENCIES @@ -38,6 +40,53 @@ ([\#1698](https://github.com/cosmos/interchain-security/pull/1698)) - Revert `PutUnbondingOnHold` behavior to ICS@v1 ([\#1819](https://github.com/cosmos/interchain-security/pull/1819)) +## v4.2.0 + +May 17, 2024 + +### API BREAKING + +- [Provider](x/ccv/provider) + - Assigning a key that is already assigned by the same validator will now be a no-op instead of throwing an error. + ([\#1732](https://github.com/cosmos/interchain-security/pull/1732)) + - Changes the `list-consumer-chains` query to include a `min_power_in_top_N` field, as well as fields for all power shaping parameters of the consumer. + ([\#1863](https://github.com/cosmos/interchain-security/pull/1863)) + +### DEPENDENCIES + +- Bump [CometBFT](https://github.com/cometbft/cometbft) to + [v0.37.6](https://github.com/cometbft/cometbft/releases/tag/v0.37.6). + ([\#1876](https://github.com/cosmos/interchain-security/pull/1876)) +- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.11). + ([\#1876](https://github.com/cosmos/interchain-security/pull/1876)) + +### FEATURES + +- [Provider](x/ccv/provider) + - Enable Opt In and Top N chains through gov proposals. + ([\#1587](https://github.com/cosmos/interchain-security/pull/1587)) + - Adding the Partial Set Security (PSS) feature cf. [ADR 015](https://cosmos.github.io/interchain-security/adrs/adr-015-partial-set-security). + PSS enables consumer chains to join ICS as _Top N_ or _Opt In_ chains and enables validators to opt to validate the consumer chains they want. + ([\#1809](https://github.com/cosmos/interchain-security/pull/1809)) + - Introduce power-shaping features for consumer chains. The features: (i) allow us to cap the total number of validators that can validate the consumer chain, (ii) set a cap on the maximum voting power (percentage-wise) a validator can have on a consumer chain, and (iii) introduce allowlist and denylists to restrict which validators are allowed or not to validate a consumer chain. + ([\#1830](https://github.com/cosmos/interchain-security/pull/1830)) + - Changes the `list-consumer-chains` query to include a `min_power_in_top_N` field, as well as fields for all power shaping parameters of the consumer. + ([\#1863](https://github.com/cosmos/interchain-security/pull/1863)) + - Introduces the `consumer-validators` query to retrieve the latest set consumer-validator set for a consumer chain. + ([\#1863](https://github.com/cosmos/interchain-security/pull/1867)) + +### STATE BREAKING + +- [Provider](x/ccv/provider) + - Enable Opt In and Top N chains through gov proposals. + ([\#1587](https://github.com/cosmos/interchain-security/pull/1587)) + - Assigning a key that is already assigned by the same validator will now be a no-op instead of throwing an error. + ([\#1732](https://github.com/cosmos/interchain-security/pull/1732)) + - Adding the Partial Set Security feature cf. [ADR 015](https://cosmos.github.io/interchain-security/adrs/adr-015-partial-set-security). + ([\#1809](https://github.com/cosmos/interchain-security/pull/1809)) + - Introduce power-shaping features for consumer chains. The features: (i) allow us to cap the total number of validators that can validate the consumer chain, (ii) set a cap on the maximum voting power (percentage-wise) a validator can have on a consumer chain, and (iii) introduce allowlist and denylists to restrict which validators are allowed or not to validate a consumer chain. + ([\#1830](https://github.com/cosmos/interchain-security/pull/1830)) ## v4.1.1 diff --git a/Dockerfile b/Dockerfile index c32b2b5787..36eaf5188b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 -FROM golang:1.21-alpine AS is-builder +FROM golang:1.22-alpine AS is-builder ENV PACKAGES curl make git libc-dev bash gcc linux-headers RUN apk add --no-cache $PACKAGES diff --git a/Dockerfile.gaia b/Dockerfile.gaia index de3f1b2ff7..3ecf9e4e72 100644 --- a/Dockerfile.gaia +++ b/Dockerfile.gaia @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # build latest tagged gaia -FROM golang:1.21-alpine AS gaia-builder +FROM golang:1.22-alpine AS gaia-builder # WORKDIR is set to /go by default ARG USE_GAIA_TAG ENV GAIA_TAG=${USE_GAIA_TAG} @@ -30,7 +30,7 @@ RUN if [ -n "${GAIA_TAG}" ]; \ # if GAIA_TAG is not set, build the latest tagged version else \ git checkout $(git tag | sort -Vr | head -n1); \ - fi + fi # Also replace sdk version in the go.mod if specified RUN if [ -d "/interchain-security/cosmos-sdk" ]; then \ @@ -40,10 +40,10 @@ RUN if [ -d "/interchain-security/cosmos-sdk" ]; then \ RUN go mod tidy # Print the version of the sdk used in the build -RUN go list -m github.com/cosmos/cosmos-sdk +RUN go list -m github.com/cosmos/cosmos-sdk RUN make build -FROM golang:1.21-alpine AS is-builder +FROM golang:1.22-alpine AS is-builder ENV PACKAGES curl make git libc-dev bash gcc linux-headers RUN apk add --no-cache $PACKAGES diff --git a/FEATURES.md b/FEATURES.md index c5d87df857..f9a54e0589 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -2,18 +2,19 @@ The following table indicates the major ICS features available in the [currently active releases](./RELEASES.md#version-matrix): -| Feature | `v3.2.0` | `v3.3.0` | `v3.3.3-lsm` | `v4.0.0` | -|---------|---------:|---------:|-------------:|---------:| -| [Channel initialization: new chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-new-chains) | βœ… | βœ… | βœ… | βœ… | -| [Validator set update](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#validator-set-update) | βœ… | βœ… | βœ… | βœ… | -| [Completion of unbonding operations](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#completion-of-unbonding-operations) | βœ… | βœ… | βœ… | βœ… | -| [Consumer initiated slashing](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#consumer-initiated-slashing) | βœ… | βœ… | βœ… | βœ… | -| [Reward distribution](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#reward-distribution) | βœ… | βœ… | βœ… | βœ… | -| [Consumer chain removal](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#consumer-chain-removal) | βœ… | βœ… | βœ… | βœ… | -| [Key assignment](https://github.com/cosmos/interchain-security/issues/26) | βœ… | βœ… | βœ… | βœ… | -| [Jail throttling](https://github.com/cosmos/interchain-security/issues/404) | βœ… | βœ… | βœ… | βœ… | -| [Soft opt-out](https://github.com/cosmos/interchain-security/issues/851) | βœ… | βœ… | βœ… | βœ… | -| [Channel initialization: existing chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-existing-chains) (aka [Standalone to consumer changeover](https://github.com/cosmos/interchain-security/issues/756)) | βœ… | βœ… | βœ… | βœ… | -| [Cryptographic verification of equivocation](https://github.com/cosmos/interchain-security/issues/732) | ❌ | βœ… | βœ… | βœ… | -| [Jail throttling with retries](https://github.com/cosmos/interchain-security/issues/713) - consumer-side changes | βœ… | βœ… | βœ… | βœ… | -| [Jail throttling with retries](https://github.com/cosmos/interchain-security/issues/713) - [provider-side changes](https://github.com/cosmos/interchain-security/issues/1102) | ❌ | ❌ | ❌ | βœ… | +| Feature | `v3.2.0` | `v3.3.0` | `v3.3.3-lsm` | `v4.0.0` | `v4.1.1` | `v4.1.1-lsm` | +|---------|---------:|---------:|-------------:|---------:|---------:|-------------:| +| [Channel initialization: new chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-new-chains) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Validator set update](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#validator-set-update) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Completion of unbonding operations](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#completion-of-unbonding-operations) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Consumer initiated slashing](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#consumer-initiated-slashing) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Reward distribution](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#reward-distribution) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Consumer chain removal](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#consumer-chain-removal) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Key assignment](https://github.com/cosmos/interchain-security/issues/26) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Jail throttling](https://github.com/cosmos/interchain-security/issues/404) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Soft opt-out](https://github.com/cosmos/interchain-security/issues/851) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Channel initialization: existing chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-existing-chains) (aka [Standalone to consumer changeover](https://github.com/cosmos/interchain-security/issues/756)) | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Cryptographic verification of equivocation](https://github.com/cosmos/interchain-security/issues/732) | ❌ | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Jail throttling with retries](https://github.com/cosmos/interchain-security/issues/713) - consumer-side changes | βœ… | βœ… | βœ… | βœ… | βœ… | βœ… | +| [Jail throttling with retries](https://github.com/cosmos/interchain-security/issues/713) - [provider-side changes](https://github.com/cosmos/interchain-security/issues/1102) | ❌ | ❌ | ❌ | βœ… | βœ… | βœ… | +| [ICS epochs](https://cosmos.github.io/interchain-security/adrs/adr-014-epochs) | ❌ | ❌ | ❌ | ❌ | βœ… | βœ… | diff --git a/Makefile b/Makefile index 715eb1acc8..e68df6fd63 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ BRANCH := $(shell git rev-parse --abbrev-ref HEAD) COMMIT := $(shell git log -1 --format='%H') # Fetch tags and get the latest ICS version by filtering tags by vX.Y.Z and vX.Y.Z-lsm # using lazy set to only execute commands when variable is used -LATEST_RELEASE ?= $(shell git fetch; git tag -l --sort -v:refname 'v*.?' 'v*.?'-lsm 'v*.??' 'v*.??'-lsm | head -n 1) +# Note: v.5.0.0 is currently excluded from the list as it's a pre-release and will be added back once it's out of pre-release status +LATEST_RELEASE ?= $(shell git fetch; git tag -l --sort -v:refname 'v*.?' 'v*.?'-lsm 'v*.??' 'v*.??'-lsm --no-contains v5.0.0 | head -n 1) # don't override user values ifeq (,$(VERSION)) @@ -246,10 +247,11 @@ proto-update-deps: ### Documentation ### ############################################################################### -build-docs: - @cd docs && ./build.sh +build-docs-deploy: + @cd docs && ./sync_versions.sh && ./build_deploy.sh -.PHONY: build-docs +build-docs-local: + @cd docs && ./build_local.sh ############################################################################### ### Test Traces ### diff --git a/RELEASES.md b/RELEASES.md index 41a2df9cfc..b1d3eefa22 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -63,6 +63,7 @@ All missing minor release versions have been discontinued. | `v3.3.x` | July 10, 2024 | | `v3.3.x-lsm` | July 10, 2024 | | `v4.0.x` | January 24, 2025 | +| `v4.1.x` | January 24, 2025 | **Note**: As of [Gaia v15.1.0](https://github.com/cosmos/gaia/releases/tag/v15.1.0), the Cosmos Hub uses a fork of Cosmos SDK ([v0.47.10-ics-lsm](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.10-ics-lsm)) @@ -81,6 +82,8 @@ Versions of Golang, IBC, Cosmos SDK and CometBFT used by ICS in the currently ac | [v3.3.0](https://github.com/cosmos/interchain-security/releases/tag/v3.3.0) | 1.20 | v7.3.0 | v0.47.5 | v0.37.2 | | [v3.3.3-lsm](https://github.com/cosmos/interchain-security/releases/tag/v3.3.3-lsm) | 1.20 | v7.3.1 | v0.47.10-ics-lsm | v0.37.4 | Provider only (Cosmos Hub specific) | | [v4.0.0](https://github.com/cosmos/interchain-security/releases/tag/v4.0.0) | 1.21 | v7.3.1 | v0.47.7 | v0.37.4 | Provider on >= v4.0.0 backwards compatible with consumers >= v3.2.0 | +| [v4.1.1](https://github.com/cosmos/interchain-security/releases/tag/v4.1.1) | 1.21 | v7.4.0 | v0.47.10 | v0.37.4 | +| [v4.1.1-lsm](https://github.com/cosmos/interchain-security/releases/tag/v4.1.1-lsm) | 1.21 | v7.4.0 | v0.47.12-ics-lsm | v0.37.4 | Provider only (Cosmos Hub specific) | **Note:** For a list of major ICS features available in the currently active releases, see [FEATURES.md](./FEATURES.md). @@ -90,11 +93,12 @@ A MAJOR version of ICS will always be backwards compatible with the previous MAJ The following table indicates the compatibility of currently active releases: -| Consumer | Provider | `v3.2.0` | `v3.3.0` | `v3.3.3-lsm` | `v4.0.0` | -|----------|----------|----------|----------|--------------|----------| -| `v3.2.0` || βœ… | βœ… (1) | βœ… | βœ… | -| `v3.3.0` || βœ… (1) | βœ… | βœ… | βœ… | -| `v4.0.0` || βœ… (1)| βœ… (1)| βœ… (1) | βœ… | +| Consumer | Provider | `v3.2.0` | `v3.3.0` | `v3.3.3-lsm` | `v4.0.0` | `v4.1.1-lsm` | +|----------|----------|----------|----------|--------------|----------|--------------| +| `v3.2.0` || βœ… | βœ… (1) | βœ… | βœ… | βœ… | +| `v3.3.0` || βœ… (1) | βœ… | βœ… | βœ… | βœ… | +| `v4.0.0` || βœ… (1)| βœ… (1)| βœ… (1) | βœ… | βœ… | +| `v4.1.1` || βœ… (1)| βœ… (1)| βœ… (1) | βœ… | βœ… | #### Notes diff --git a/app/provider/app.go b/app/provider/app.go index 32bb17050a..3047ab507d 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -519,12 +519,14 @@ func New( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - transferModule := transfer.NewAppModule(app.TransferKeeper) - ibcmodule := transfer.NewIBCModule(app.TransferKeeper) + // Add an IBC middleware callback to track the consumer rewards + var transferStack porttypes.IBCModule + transferStack = transfer.NewIBCModule(app.TransferKeeper) + transferStack = ibcprovider.NewIBCMiddleware(transferStack, app.ProviderKeeper) // create static IBC router, add transfer route, then set and seal it ibcRouter := porttypes.NewRouter() - ibcRouter.AddRoute(ibctransfertypes.ModuleName, ibcmodule) + ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack) ibcRouter.AddRoute(providertypes.ModuleName, providerModule) app.IBCKeeper.SetRouter(ibcRouter) @@ -556,7 +558,7 @@ func New( ibc.NewAppModule(app.IBCKeeper), ibctm.NewAppModule(), params.NewAppModule(app.ParamsKeeper), - transferModule, + transfer.NewAppModule(app.TransferKeeper), providerModule, ) diff --git a/docs/README.md b/docs/README.md index aaba2fa1e1..4c4146ca4b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,17 +1,17 @@ # Website -This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. +This website is built using [Docusaurus 3](https://docusaurus.io/), a modern static website generator. ### Installation ``` -$ yarn +$ npm install ``` ### Local Development ``` -$ yarn start +$ npm run start ``` This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. @@ -19,23 +19,55 @@ This command starts a local development server and opens up a browser window. Mo ### Build ``` -$ yarn build +$ npm run build ``` This command generates static content into the `build` directory and can be served using any static contents hosting service. -### Deployment -Using SSH: +# Adding versions +To add/remove versions from the page you can modify `versions.json`. + +At the time of writing it looked like this: +```json +[ + "v4.0.0", + "v4.1.0", + "v5.0.0-rc0" +] ``` -$ USE_SSH=true yarn deploy -``` -Not using SSH: +You can remove any version that you no longer need and the build process will remove it from the final page. + + +# Accessing versioned docs locally +```shell +# from interchain-security/docs run: +./sync_versions.sh ``` -$ GIT_USER= yarn deploy + +The script above will create `versioned_docs` and `versioned_sidebars` directories inside `interchain-security/docs`. + +To view the docs run: + +```shell +npm run start ``` -If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. +Remember to check back out to your working branch. Running `./sync_versions.sh` will leave you in a detached head state. +(simply run `git checkout ) + +## Note: +The script will exit if you have uncommitted changes. +The script switches branches while building the versioned docs - **please note that this could overwrite your local changes**. + + +# Legacy documentation + +`legacy-docs-page` [branch](https://github.com/cosmos/interchain-security/tree/legacy-docs-page) contains documentation for versions `<= v4.0.0`. These versions were built using docusaurus `v2.4.0` which is not compatible with docusaurus `v3.x` used at the time of writing. It was not feasible to port the legacy docs from `v2.4.0` because `v3.x` is not compatible with it and it required changing all release branches and cutting patch releases. + +The `./docs/legacy` directory on `legacy-docs-page` was created manually, by modifying `docusaurus.config.js` and `versions.json` on `https://github.com/cosmos/interchain-security/releases/v3.3.1-lsm` and generating the static pages manually using `npm run build`. + +The `./docs/legacy` directory gets included into the rest of the documentation using a simple `cp` command during the deploy process using the [build_deploy.sh](./build_deploy.sh) script. It is **not** included during local builds. diff --git a/docs/build.sh b/docs/build.sh deleted file mode 100755 index b39a0539a6..0000000000 --- a/docs/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# This builds docs using docusaurus. -COMMIT=$(git rev-parse HEAD) -echo "building docusaurus main docs" -(git clean -fdx && git reset --hard && git checkout $COMMIT) -npm ci && npm run build -mv build ~/output -echo "done building docusaurus main docs" -# echo $DOCS_DOMAIN > ~/output/CNAME diff --git a/docs/build_local.sh b/docs/build_local.sh new file mode 100755 index 0000000000..b93f147b0a --- /dev/null +++ b/docs/build_local.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +echo "building docusaurus from local branch" +npm ci && npm run build +echo "done building docusaurus from local docs" diff --git a/docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md b/docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md index 4438b83239..1e1a3f08cf 100644 --- a/docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md +++ b/docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md @@ -31,7 +31,7 @@ multiple nodes, called primary and witness nodes. Light clients download new headers committed on chain from a primary. Headers can be verified in two ways: sequentially, where the block height of headers is serial, or using skipping. This second verification method allows light clients to download headers -with nonconsecutive block height, where some intermediate headers are skipped (see [Tendermint Light Client, Figure 1 and Figure 3](https://arxiv.org/pdf/2010.07031.pdf)). +with nonconsecutive block height, where some intermediate headers are skipped (see [Tendermint Light Client, Figure 1 and Figure 3](https://arxiv.org/pdf/2010.07031)). Additionally, light clients are cross-checking new headers obtained from a primary with witnesses to ensure all nodes share the same state. A light client attack occurs when a Byzantine validator sends invalid headers to a light client. diff --git a/docs/docs/adrs/adr-014-epochs.md b/docs/docs/adrs/adr-014-epochs.md index fc669e9b36..7637078cf0 100644 --- a/docs/docs/adrs/adr-014-epochs.md +++ b/docs/docs/adrs/adr-014-epochs.md @@ -10,7 +10,7 @@ title: Epochs ## Status -Proposed +Accepted ## Context diff --git a/docs/docs/adrs/adr-015-partial-set-security.md b/docs/docs/adrs/adr-015-partial-set-security.md index e89c46b5cf..0c3a331dfb 100644 --- a/docs/docs/adrs/adr-015-partial-set-security.md +++ b/docs/docs/adrs/adr-015-partial-set-security.md @@ -10,7 +10,7 @@ title: Partial Set Security ## Status -Proposed +Accepted ## Context diff --git a/docs/docs/adrs/adr-016-securityaggregation.md b/docs/docs/adrs/adr-016-securityaggregation.md new file mode 100644 index 0000000000..0709f4a582 --- /dev/null +++ b/docs/docs/adrs/adr-016-securityaggregation.md @@ -0,0 +1,203 @@ +--- +sidebar_position: 17 +title: Security aggregation +--- +# ADR 016: Security aggregation + +## Changelog + +- 2024-04-24: Initial draft of ADR + +## Status + +Proposed + +## Context + +Security Aggregation enables staking of tokens from external sources such as Ethereum or Bitcoin to Cosmos blockchains. By integrating Security Aggregation, a Cosmos blockchain can be secured by both native tokens and external tokens (e.g. ETH, BTC). + +Security Aggregation consists of the following parts: + +- A mechanism for delegating external tokens to Cosmos validators, such as Babylon or EigenLayer AVS contract. +- An oracle that tracks how much external stake has been delegated to each Cosmos validator and provides price feeds for external tokens. +- Power mixing: a mechanism to combine external and native stake to derive the power of each validator. +- A reward distribution protocol that enables sending back rewards to the external source. + +External staking information is received from an oracle together with price information of related stakes. +The CosmosLayer derives validator powers based on external and native staking information and initiates rewarding of external depositors. + +This ADR describes the _Cosmos modules_ of the solution. + +## Alternative Approaches + +### Rewards +As an alternative to sending rewards back to the external chains, stakers could be rewarded on the Cosmos chain. +This would require a mapping of external addresses to addresses on Cosmos chain for each staker on external source. +In addition detailed external staking information such as staking addresses, amount of stakes per staker and validator, etc. have to be provided by the oracle. + +## Decision + +### Rewards will be sent back to external chains instead of paying rewards for external stakers on Cosmos chain +Rewards will be sent back to external chains instead of paying rewards for external stakers on Cosmos chain +- due to amount of additional staking information to be sent and tracked by the oracle +- due to the additional complexity of managing external and Cosmos addresses + +## Detailed Design + +The `Power Mixing` feature and `Reward Distribution` protocol are an integral part of the Security Aggregation solution. +The `Power Mixing` module provides the capability of deriving validator power based on stake originated from external sources such as Ethereum/Bitcoin and the native staking module. +The `Reward Distribution` manages the process of sending rewards to external stakers. + +### Power Mixing + +Power Mixing provides the final validator powers based on staking information of the native chain and the external stakes. The information about external staking and related price feeds are received from an oracle. +Once the final validator powers are determined the result is submitted to the underlying CometBFT consensus layer by [updating](https://docs.cometbft.com/v0.38/spec/abci/abci++_app_requirements#updating-the-validator-set) the validator set. + +Requirements: + +- validator updates are performed on each EndBlock +- a validator's power is determined based on its native on-chain stakes and external stakes +- price information of staked tokens is used to determine a validator’s power, e.g. price ratio (price of native on-chain token / price of external stake) +- price information of native/external tokens are received from an oracle +- staking information from external sources received from the oracle +- native staking information are received from the `Cosmos SDK Staking Module` +- set of validator stakes from oracle always have the current price, full set of validators, and current stakes + +The `Power Mixing` implementation +- queries current validators and their powers from [x/staking](https://github.com/cosmos/cosmos-sdk/blob/a6f3fbfbeb7ea94bda6369a7163a523e118a123c/x/staking/types/staking.pb.go#L415) +and from oracle (see below). +- calculates power updates by mixing power values of external and internal sources +Following pseudocode snippet shows a possible implementation of how power mixing +feature works. +```golang +// PowerSource is an abstract entity providing validator powers which +// are used by the mixer. This can be an oracle, staking module or an +// IBC connected bridge. +type PowerSource interface { + GetValidatorUpdates() []abci.ValidatorUpdate +} + +// MixPowers calculates power updates by mixing validator powers from different sources +func (k *Keeper) MixPowers(source ...PowerSource) []abci.ValidatorUpdate { + var valUpdate []abci.ValidatorUpdate + for _, ps := range source { + // mix powers from two sets of validator updates an return set of validator updates + // with aggregated powers + valUpdate = mixPower(valUpdate, ps.GetValidatorUpdates()) + } + return valUpdate +} + +func (k *keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + // GetPowerSources (including local staking module) + registeredPowerSource := GetPowerSources() + return k.MixPowers(registeredPowerSource...) +} +``` + +#### Integration with `ICS provider` +The provider module updates the validator set on CometBFT instead of the SDK staking module (x/staking). The provider implementation will intervene in this behavior and ensure that the validator updates are taken from the `Power Mixing` feature. + +External power sources are managed by the provider module. Only registered power sources can provide input to the `Power Mixing` feature. +Power sources will be assigned a unique identifier which will be used by the oracle, provider module and the power mixing and rewarding feature. + +Updates with the next validator set are sent to consumer chains on each epoch (see `EndBlockVSU()`). +When collecting the validator updates for each consumer chain (see [`QueueVSCPackets()`](https://pkg.go.dev/github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper#Keeper.QueueVSCPackets)), the validator powers of the bonded validators will be updated with the validator powers from the external sources using the `Power Mixing` module. +These updates are sent as part of the VSC packets to all registered consumer chains. + +#### Integration with `ICS consumer` +Consumer chains receive validator updates as part of VSC packets from the provider. +These packets contain validator powers which were already mixed with external staked powers. + + +### Queries + +```protobuf +// GetValidatorUpdates returns the power mixed validator results from the provided sources +service Query { + rpc GetValidatorUpdates(PowerMixedValUpdateRequest) PowerMixedValUpdateResponse {}; +} + +// PowerMixedValUpdateRequest contains the list of power sources on which the +// power mixing should be based on +message PowerMixedValUpdateRequest { + repeated PowerSource sources; +} + +// PowerMixedValUpdateResponse returns the validator set with the updated powers +// from the power mixing feature +message PowerMixedValUpdateResponse { + repeated abci.ValidatorUpdate val_set +} +``` + + +The following queries will be provided by the oracle + +```protobuf +service Query { + rpc GetExtValidators(GetExtValidatorRequest) returns (ExtValidatorsResponse) { + option (google.api.http).get = "oracle/v1/get_validators"; + }; +} + +message GetExtValidatorRequest {} + +// ExtValidatorsResponse is the response from GetExtValidators queries +message ExtValidatorsResponse { + repeated ExtValPower powers; +} + +// ExtValPower represents a validator with its staking and token information, +// where: +// `power_source_identifier` is the identifier of the registered power source +// `validator_address` is the address of the validator +// `stakes` is the total amount of stakes for a validator +// `denom` is the source token of the stake e.g. ETH,BTC +// `price_ratio` is the ratio of price of the external token to the price of the 'local' token +message ExtValPower { + string power_source_identifier; + string validator_address; + uint64 stakes; + string denom; + float price_ratio; +} + +// GetPrice returns a price feed for a given token +service Query { + rpc GetPrice(GetPriceRequest) returns (GetPriceResponse) { + option (google.api.http).get = "/oracle/v1/get_price"; + }; +} +``` + +For security reasons the amount of external stakes needs to be limited. Limitation of external staking could be driven by governance and is not subject of this version of the ADR. + +### Reward Handler + +For native staked tokens the `Distribution Module` of the Cosmos SDK is taking care of sending the rewards to stakers. +For stakes originated from external chains (Ethereum/Bitcoin) the `Reward Handler` module sends rewards to EigenLayer/Babylon. +The transfer of rewards is done using a bridge between the Cosmos chain and the external provider chain. + +Note: currently there's no support paying rewards on EigenLayer (see [here](https://www.coindesk.com/tech/2024/04/10/eigenlayer-cryptos-biggest-project-launch-this-year-is-still-missing-crucial-functionality/)) + +## Consequences + +### Positive + +* Allow external depositors to stake their tokens to secure a Cosmos chain + +### Negative +* Dependency to external sources e.g (price feeds) for validator power calculation +* Security impact + +### Neutral +* Additional complexity for staking + +## Questions: +- Slashing: subject of this ADR? (Defined but [not activated](https://www.coindesk.com/tech/2024/04/10/eigenlayer-cryptos-biggest-project-launch-this-year-is-still-missing-crucial-functionality/) currently on EigenLayer). + +## References + +- [EigenLayer](https://docs.eigenlayer.xyz/) +- [Babylon](https://babylonchain.io/) diff --git a/docs/docs/adrs/adr-017-allowing-inactive-validators.md b/docs/docs/adrs/adr-017-allowing-inactive-validators.md new file mode 100644 index 0000000000..9a3715f135 --- /dev/null +++ b/docs/docs/adrs/adr-017-allowing-inactive-validators.md @@ -0,0 +1,122 @@ +--- +sidebar_position: 18 +title: ICS with Inactive Provider Validators +--- +# ADR 017: ICS with Inactive Provider Validators + +## Changelog +* 15th May 2024: Initial draft + + +## Status + +Proposed + +## Context + +Currently, only validators in the active set on the provider can validate on consumer chains, which limits the number of validators that can participate in Interchain Security (ICS). +Validators outside of the active set might be willing +to validate on consumer chains, but we might not want to make the provider validator set larger, e.g. to not put more strain on the consensus engine. +This runs the risk of leaving consumer chains with too few validators. + +The purpose of this ADR is to allow validators that are *not* part of the consensus process on the provider chain (because they are inactive) +to validate on consumer chains. + +In the context of this ADR, "consensus validator set" is the set of validators participating in the consensus protocol, and "staking validator set" is the set of validators viewed as active by the staking module. + +Currently, the staking module, provider module, and CometBFT interact in this way: + +![inactivevals_before.png](../../figures/inactivevals_before.png) + +The staking module keeps a list of validators. The `MaxValidators` validators with the largest amount of stake are "active" validators. `MaxValidators` is a parameter of the staking module. The staking module sends these validators to CometBFT to inform which validators make up the next consensus validators, that is, the set of validators participating in the consensus process. Separately, the provider module reads the list of bonded validators and sends this to the consumer chain, after shaping it according to which validators are opted in and the parameters set by the consumer chain for allowlist, denylist, etc. + +## Decision + +The proposed solution to allow validators that are not participating in the consensus process on the provider (inactive validators) is to change 3 main things: + +a) increase the `MaxValidators` parameter of the staking module + +b) do *not* take the updates for CometBFT directly from the bonded validators in the staking module, by wrapping the staking modules `EndBlocker` with a dummy EndBlocker that doesn't return any validator updates. Instead, we adjust the provider module to return validator updates on its EndBlocker. These validator updates are obtained by *filtering* the bonded validators to send only the first `MaxProviderConsensusValidators` (sorted by largest amount of stake first) many validators to CometBFT + +c) use the enlarged list of bonded validators from the staking module as basis for the validator set that the provider module sends to consumer chains (again after applying power shaping and filtering out validatiors that are not opted in). + +In consequence, the provider chain can keep a reasonably-sized consensus validator set, while giving consumer chains a much larger pool of potential validators. + +![inactivevals_after.png](../../figures/inactivevals_after.png) + + +Some additional considerations: + +* Migration: In the migration, the last consensus validator set will be set to the last active validator set from the view of the staking module. Existing consumer chains are migrated to have a validator set size cap (otherwise, they could end up with a huge validator set including all the staking-but-not-consensus-active validators from the provider chain) +* Slashing: Validators that are not part of the active set on the provider chain can still be jailed for downtime on a consumer chain (via an Interchain Security SlashPacket sent to the provider, who will then jail the validator), but they *are not* slashed for downtime on the provider chain. +This is achieved without any additional changes to the slashing module, because the slashing module checks for downtime by looking at the consensus participants reported by CometBFT, and thus with the proposed solution, validators that are not part of the consensus validators on the provider chain are not considered for downtime slashing (see https://github.com/cosmos/cosmos-sdk/blob/v0.47.11/x/slashing/abci.go#L22). +* Rewards: Validators that are not part of the active set on the provider chain can still receive rewards on the consumer chain, but they *do not* receive rewards from the provider chain. This change is +achieved without further changes to staking or reward distributions, because similar to downtime, rewards are based on the consensus validator set (see https://github.com/cosmos/cosmos-sdk/blob/v0.47.11/x/distribution/abci.go#L28) + + +### Changes to the state + +The following changes to the state are required: + +* Introduce the `MaxProviderConsensusValidators` parameter to the provider module, which is the number of validators that the provider module will send to consumer chains. +* Store the provider consensus validator set in the provider module state under the `LastProviderConsensusValsPrefix` key. This is the last set of validators that the provider sent to the consensus engine. This is needed to compute the ValUpdates to send to the consensus engine (by diffing the current set with this last sent set). +* Increase the `MaxValidators` parameter of the staking module to the desired size of the potential validator +set of consumer chains. + +## Risk Mitigations + +To mitigate risks from validators with little stake, we introduce a minimum stake requirement for validators to be able to validate on consumer chains, which can be set by each consumer chain independently, with a default value set by the provider chain. + +Additionally, we indepdently allow individual consumer chains to disable this feature, which will disallow validators from outside the provider active set from validating on the consumer chain and revert them to the previous behaviour of only considering validators of the provider that are part of the active consensus validator set. + +Additional risk mitigations are to increase the active set size slowly, and to monitor the effects on the network closely. For the first iteration, we propose to increase the active set size to 200 validators (while keeping the consensus validators to 180), thus letting the 20 validators with the most stake outside of the active set validate on consumer chains. + +## Consequences + +### Positive + +* Validators outside of the active set can validate on consumer chains without having an impact on the consensus engine of the provider chain +* Consumer chains can have a much larger validator set than the provider chain if they prefer this e.g. for decentralization reasons +* Consumer chain teams can, with much less cost than today, start up their own consumer chain node to keep the chain running (in a centralized manner) even if no hub validators have opted in to validate on the chain. This is useful to stop the chain from ending up with an empty validator set and becoming recoverable only with a hardfork + +### Negative + +Allowing validators from the inactive set brings with it some additional risks. +In general, consumer chains will now face some of the problems also faced by standalone chains. It’s reasonable to assume that the validator set on the hub has a minimum amount of operational quality due to being battle tested and decentralized, and consumer chains with validators from outside the hub active set cannot rely on this as much anymore. + + +#### Sybil attacks + +With the restricted size of the active set today, it’s clear that the set is at least minimally competitive and it is not trivial to spin up multiple nodes as a validator. + +When we make the β€œpotential validator set” much larger, we should assume that it becomes much less competitive to be part of that set, and thus trivial for single entities to control many of those validators. + +#### Reputational damage is not a deterrent + +For validators in the active set, we typically assume that if they would misbehave, they pay a large reputational cost. This represents delegators deciding to switch validators (potentially even on chains other than the one the misbehaviour happened on), and loss of credibility in the ecosystem. With the much larger active set, it seems prudent to assume that reputational damage is not a deterrent for many validators. They might only have minimal amounts of delegated stake and control most of it themselves, so they might not be deterred from performing actions that would usually bring reputational damage. + +#### Additional negative consequences +* The provider keeper will need to implement the staking keeper interface, and modules need to be wired up to either the staking or provider keeper, depending on whether they need the consensus or staking validator set +* This will impact how future modules are integrated, since we will need to consider whether those modules should consider the consensus validators or the bonded validators (which other modules might assume to be the same) + +### Neutral + +* There might be validators that are bonded, but not validating on any chain at all. This is not a problem, but it might be a bit confusing. + +## Alternative considerations + +### Modifying the staking module + +We could instead adapt the *staking module* with a similar change. +This might be better if it turns out that the staking module active set is used in many other places. + +### Allowing unbonding validators to validate + +Instead of increasing the active set size, we could allow validators that are unbonded (but still exist on the provider) to validate consumer chains. +For this, we would need to: +* Modify the VSC updates to consider the set of all validators, even unbonded ones, instead of just active ones +* Adjust our downtime jailing/equivocation slashing logic to work correctly with unbonded validators. This is very hard, because redelegations are not usually tracked for unbonded validators. + +## References + +* [Security Aggregation](./adr-016-securityaggregation.md) has similar concerns where the staking validator set will differ from the consensus validator set diff --git a/docs/docs/adrs/intro.md b/docs/docs/adrs/intro.md index 0ba2b5096e..fc7d06a152 100644 --- a/docs/docs/adrs/intro.md +++ b/docs/docs/adrs/intro.md @@ -40,12 +40,14 @@ To suggest an ADR, please make use of the [ADR template](./adr-template.md) prov - [ADR 009: Soft Opt-Out](./adr-009-soft-opt-out.md) - [ADR 010: Standalone to Consumer Changeover](./adr-010-standalone-changeover.md) - [ADR 013: Slashing on the provider for consumer equivocation](./adr-013-equivocation-slashing.md) +- [ADR 014: Epochs](./adr-014-epochs.md) +- [ADR 015: Partial Set Security](./adr-015-partial-set-security.md) ### Proposed - [ADR 011: Improving testing and increasing confidence](./adr-011-improving-test-confidence.md) -- [ADR 014: Epochs](./adr-014-epochs.md) -- [ADR 015: Partial Set Security](./adr-015-partial-set-security.md) +- [ADR 016: Security aggregation](./adr-016-securityaggregation.md) +- [ADR 017: ICS with Inactive Provider Validators](./adr-017-allowing-inactive-validators.md) ### Rejected diff --git a/docs/docs/consumer-development/app-integration.md b/docs/docs/consumer-development/app-integration.md index 81d9141242..73c034d073 100644 --- a/docs/docs/consumer-development/app-integration.md +++ b/docs/docs/consumer-development/app-integration.md @@ -28,5 +28,6 @@ This allows the consumer chain to leverage those modules while also using the `x With these modules enabled, the consumer chain can mint its own governance tokens, which can then be delegated to prominent community members which are referred to as "representatives" (as opposed to "validators" in standalone chains). The token may have different use cases besides just voting on governance proposals. ## Standalone chain to consumer chain changeover -This feature is being actively worked on. Information will be provided at a later time. + +See the [standalone chain to consumer chain changeover guide](./changeover-procedure.md) for more information on how to transition your standalone chain to a consumer chain. diff --git a/docs/docs/consumer-development/changeover-procedure.md b/docs/docs/consumer-development/changeover-procedure.md index 0a3954283a..332bade599 100644 --- a/docs/docs/consumer-development/changeover-procedure.md +++ b/docs/docs/consumer-development/changeover-procedure.md @@ -150,7 +150,7 @@ Additionally, reach out to the community via the [forum](https://forum.cosmos.ne - [ ] determine consumer chain parameters to be put in the proposal - [ ] take note to include a link to your onboarding repository -Example of a consumer chain addition proposal. +Example of a consumer chain addition proposal (compare with the [ConsumerAdditionProposal](./onboarding.md#3-submit-a-governance-proposal) in the ICS Provider Proposals section for chains that *launch* as consumers): ```js // ConsumerAdditionProposal is a governance proposal on the provider chain to spawn a new consumer chain or add a standalone chain. @@ -167,7 +167,6 @@ Example of a consumer chain addition proposal. // Must be unique from all other consumer chain ids of the executing provider chain. "chain_id": "standalone-1", // Initial height of new consumer chain. - // For a completely new chain, this will be {0,1}. "initial_height" : { // must correspond to current revision number of standalone chain // e.g. standalone-1 => "revision_number": 1 diff --git a/docs/docs/consumer-development/onboarding.md b/docs/docs/consumer-development/onboarding.md index f4f022c946..9f438dd8d4 100644 --- a/docs/docs/consumer-development/onboarding.md +++ b/docs/docs/consumer-development/onboarding.md @@ -41,12 +41,15 @@ Additionally, reach out to the community via the [forum](https://forum.cosmos.ne - [ ] determine consumer chain parameters to be put in the proposal - [ ] take note to include a link to your onboarding repository - [ ] describe the purpose and benefits of running your chain +- [ ] determine whether your chain should be an Opt-In chain or a Top N chain (see [Partial Set Security](../features/partial-set-security.md)) +- [ ] if desired, decide on power-shaping parameters (see [Power Shaping](../features/power-shaping.md)) Example of a consumer chain addition proposal. ```js // ConsumerAdditionProposal is a governance proposal on the provider chain to spawn a new consumer chain. -// If it passes, then all validators on the provider chain are expected to validate the consumer chain at spawn time. +// If it passes, if the top_N parameter is not equal to 0, the top N% of validators by voting power on the provider chain are expected to validate the consumer chain at spawn time. +// Otherwise, only validators that opted in during the proposal period are expected to validate the consumer chain at spawn time. // It is recommended that spawn time occurs after the proposal end time. { // Title of the proposal @@ -69,7 +72,7 @@ Example of a consumer chain addition proposal. // Hash of the consumer chain binary that should be run by validators on chain initialization. // It is used for off-chain confirmation of binary validity by validators and other parties. "binary_hash": "376cdbd3a222a3d5c730c9637454cd4dd925e2f9e2e0d0f3702fc922928583f1", - // Time on the provider chain at which the consumer chain genesis is finalized and all validators + // Time on the provider chain at which the consumer chain genesis is finalized and validators // will be responsible for starting their consumer chain validator node. "spawn_time": "2023-02-28T20:40:00.000000Z", // Unbonding period for the consumer chain. @@ -97,13 +100,34 @@ Example of a consumer chain addition proposal. // Note that transfer_channel_id is the ID of the channel end on the consumer chain. // it is most relevant for chains performing a standalone to consumer changeover // in order to maintain the existing ibc transfer channel - "distribution_transmission_channel": "channel-123" + "distribution_transmission_channel": "channel-123", + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + "top_N": 95, + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + "validators_power_cap": 0, + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + "validator_set_cap": 0, + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + "allowlist": [], + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + "denylist": [] } ``` ## 4. Launch -The consumer chain starts after at least 66.67% of all provider's voting power comes online. The consumer chain is considered interchain secured once the appropriate CCV channels are established and the first validator set update is propagated from the provider to the consumer +The consumer chain starts after at least 66.67% of its voting power comes online. +Note that this means 66.67% of the voting power in the *consumer* validator set, which will be comprised of all validators that either opted in to the chain or are part of the top N% of the provider chain (and are thus automatically opted in). +The consumer chain is considered interchain secured once the appropriate CCV channels are established and the first validator set update is propagated from the provider to the consumer - [ ] provide a repo with onboarding instructions for validators (it should already be listed in the proposal) - [ ] genesis.json with ccv data populated (MUST contain the initial validator set) diff --git a/docs/docs/features/democracy-modules.md b/docs/docs/features/democracy-modules.md index a138bb0413..5add40c67e 100644 --- a/docs/docs/features/democracy-modules.md +++ b/docs/docs/features/democracy-modules.md @@ -229,7 +229,7 @@ func NewApp(...) { The `x/ccv/democracy/governance` module extends the `x/governance` module with the functionality to filter proposals. :::tip -Consumer chains can limit in the types of governance proposals that can be executed on chain to avoid inadvertant changes to interchain security protocol that could affect security properties. +Consumer chains can limit in the types of governance proposals that can be executed on chain to avoid inadvertent changes to interchain security protocol that could affect security properties. ::: The module uses `AnteHandler` to limit the types of proposals that can be executed. diff --git a/docs/docs/features/key-assignment.md b/docs/docs/features/key-assignment.md index 1906eb8b78..85dcb8e074 100644 --- a/docs/docs/features/key-assignment.md +++ b/docs/docs/features/key-assignment.md @@ -81,6 +81,11 @@ To change your key, simply repeat all of the steps listed above. Take note that To remove a key, simply switch it back to the consensus key you have assigned on the provider chain by following steps in the `Adding a key` section and using your provider consensus key. +:::warning +Validators are strongly recommended to assign a separate key for each consumer chain +and **not** reuse the provider key across consumer chains for security reasons. +::: + ## Querying proposed consumer chains To query the consumer addition proposals that are in the voting period, you can use the following command on the provider: diff --git a/docs/docs/features/partial-set-security.md b/docs/docs/features/partial-set-security.md new file mode 100644 index 0000000000..a2edbbb15d --- /dev/null +++ b/docs/docs/features/partial-set-security.md @@ -0,0 +1,28 @@ +--- +sidebar_position: 5 +--- + +# Partial Set Security + +Partial Set Security (PSS) allows consumer chains to leverage only a subset of validators from the provider chain, which offers more flexibility than the traditional Replicated Security model. By introducing the top_N parameter, each consumer chain can choose the extent of security needed: + + * Top N: Requires the top N% validators from the provider chain to secure the consumer chain. This guarantees that the validators with the most power on the provider will validate the consumer chain, while others can voluntarily opt in. + + * Opt-In: If the `top_N` parameter is set to zero, no validator is mandated to secure the consumer chain. Instead, any validator from the provider chain can opt in using a dedicated transaction. + +An advantage of a Top N chain is that the consumer chain is guaranteed to receive at least a certain fraction of the market cap of the provider chain in security. In turn, this chain needs to be approved by governance, since validators will be forced to run the chain. Thus, Top N chains should typically expect to need to provide a strong case for why they should be added to the provider chain, and they should make sure they offer enough rewards to incentivize validators and delegators to vote for their proposal. + +Opt-In chains, on the other hand, are more flexible. While for technical reasons, they are also currently added via governance proposals, since validators are never forced to validate these chains and simply opt in if they want to, they should typically expect to get their proposals approved much more easily compared to Top N chains, since validators that do not want to validate the chain can simply choose not to opt in. +However, opt in chains do not get a fixed amount of security as a relation of the market cap of the provider as top N chains do, so opt in chains might want to keep an eye on how many validators have opted in to validate their chain and adjust their reward emissions accordingly to incentivize validators. + +:::tip +Partial Set Security is handled only by the provider chain - the consumer chains are simply sent validator sets, and they are not aware that this represents only a subset of the provider chain's validator set. +::: + +:::caution +Both Opt In and Top N chains currently require a governance proposal to be added to the provider chain. + +For Top N chains, this is also the long term vision for how they are launched. + +For Opt In chains, this is a temporary measure to prevent issues around chain ID squatting, i.e. someone could spuriously register many desirable chain IDs of upcoming consumer chain and simply deny legitimate consumer chains from using them. Eventually, the plan is to allow launching Opt In chains permissionlessly without going through governance, with quality control being handled by the market of validators deciding which chains they would like to validate on. +::: diff --git a/docs/docs/features/power-shaping.md b/docs/docs/features/power-shaping.md new file mode 100644 index 0000000000..726ff031c6 --- /dev/null +++ b/docs/docs/features/power-shaping.md @@ -0,0 +1,62 @@ +# Power Shaping + +To give consumer chains more flexibility in choosing their validator set, Interchain Security offers +several "power shaping" mechanisms for consumer chains. + +These are: +1) **Capping the size of the validator set**: The consumer chain can specify a maximum number of validators it +wants to have in its validator set. This can be used to limit the number of validators in the set, which can +be useful for chains that want to have a smaller validator set for faster blocks or lower overhead. If more validators +than the maximum size have opted in on a consumer chain, only the validators with the highest power, up to the specified +maximum, will validate the consumer chain. +:::info +This is only applicable to Opt In chains (chains with Top N = 0). +::: +1) **Capping the fraction of power any single validator can have**: The consumer chain can specify a maximum fraction +of the total voting power that any single validator in its validator set should have. +This is a security measure with the intention of making it harder for a single large validator to take over a consumer chain. This mitigates the risk of an Opt In chain with only a few validators being dominated by a validator with a large amount of stake opting in. +For example, setting this fraction to e.g. 33% would mean that no single validator can have more than 33% of the total voting power, +and thus there is no single validator who would stop the chain by going offline. +:::info +This is a soft cap, and the actual power of a validator can exceed this fraction if the validator set is small (e.g. there are only 3 validators and the cap is 20%). +::: +:::info +Rewards are distributed proportionally to validators with respect to their capped voting power on the consumer, +not their total voting power on the provider. +::: +1) **Allowlist and denylist**: The consumer chain can specify a list of validators that are allowed or disallowed from participating in the validator set. If an allowlist is set, all validators not on the allowlist cannot validate the consumer chain. If a validator is on both lists, the denylist takes precedence, that is, they cannot validate the consumer chain. If neither list is set, all validators are able to validate the consumer chain. + +:::warning +Note that if denylisting is used in a Top N consumer chain, then the chain might not be secured by N% of the total provider's +power. For example, consider that the top validator `V` on the provider chain has 10% of the voting power, and we have a Top 50% consumer chain, +then if `V` is denylisted, the consumer chain would only be secured by at least 40% of the provider's power. +::: + +All these mechanisms are set by the consumer chain in the `ConsumerAdditionProposal`. They operate *solely on the provider chain*, meaning the consumer chain simply receives the validator set after these rules have been applied and does not have any knowledge about whether they are applied. + +Each of these mechanisms is *set during the consumer addition proposal* (see [Onboarding](../consumer-development/onboarding.md#3-submit-a-governance-proposal)), and is currently *immutable* after the chain has been added. + +The values can be seen by querying the list of consumer chains: +```bash +interchain-security-pd query provider list-consumer-chains +``` + +## Guidelines for setting power shaping parameters + +When setting power shaping parameters, please consider the following guidelines: +* Do not cap the validator set size too low: Notice that this number is the **maximum* number of validators that will ever validate the consumer chain. If this number is too low, the chain will be very limited in the +amount of stake that secures it. The validator set size cap should only be used if there are strong reasons to prefer fewer validators. Consider that setting the cap will mean that +even if the whole validator set of the provider wants to validate on the chain, some validators will simply not be able to. +* Capping the fraction of power any single validator can have is a decent security measure, but it's good to be aware of the interactions with the size of the validator set. +For example, if there are only 3 validators, and the cap is 20%, this will not be possible (since even splitting the power fairly would mean that each validator has 33% of the power, so is above the cap). +However, the cap can be a good measure to prevent a single large validator from essentially taking over the chain. +In general, values under 33% make sense (since a validator that has 33% of the chains power would halt the chain if they go offline). +Notice that the smaller this value is, the more the original voting power gets distorted, which could discourage large validators from deciding to opt in to the chain. +* If the allowlist is *empty*, all validators can validate the chain. If it is *non empty*, then *only* validators on the allowlist can validate the chain. +Thus, an allowlist containing too few validators is a security risk. In particular, consider that if the validators on the allowlist lose a lot of stake or stop being validators, +an allowlist that is too short can very quickly become outdated and leave too few validators, or validators with too little stake, to secure the chain in a decentralized way. +* If the denylist is too full, this can likewise be problematic. If too many large validators are denylisted, the chain might not be secured by a large enough fraction of the provider's power, in particular when +the power distribution on the provider shifts and the denylisted validators gain more power. + +In general, when setting these parameters, consider that the voting power distribution in the future might be very different from the one right now, +and that the chain should be secure even if the power distribution changes significantly. \ No newline at end of file diff --git a/docs/docs/features/proposals.md b/docs/docs/features/proposals.md index f2d2e3d4b2..1f188b8567 100644 --- a/docs/docs/features/proposals.md +++ b/docs/docs/features/proposals.md @@ -42,10 +42,13 @@ Minimal example: "blocks_per_distribution_transmission": 1000, "historical_entries": 10000, "genesis_hash": "d86d756e10118e66e6805e9cc476949da2e750098fcc7634fd0cc77f57a0b2b0", - "binary_hash": "376cdbd3a222a3d5c730c9637454cd4dd925e2f9e2e0d0f3702fc922928583f1" - // relevant for chains performing a standalone to consumer changeover - // in order to maintain the existing ibc transfer channel - "distribution_transmission_channel": "channel-123" + "binary_hash": "376cdbd3a222a3d5c730c9637454cd4dd925e2f9e2e0d0f3702fc922928583f1", + "distribution_transmission_channel": "channel-123", + "top_N": 95, + "validators_power_cap": 0, + "validator_set_cap": 0, + "allowlist": [], + "denylist": [] } ``` More examples can be found in the interchain security testnet repository [here](https://github.com/cosmos/testnets/blob/master/interchain-security/stopped/baryon-1/proposal-baryon-1.json) and [here](https://github.com/cosmos/testnets/blob/master/interchain-security/stopped/noble-1/start-proposal-noble-1.json). @@ -74,6 +77,13 @@ Minimal example: } ``` +:::warning +Before the introduction of Partial Set Security, consumer chains typically included a "soft opt-out mechanism" +which allows the bottom N% of the provider's validators to not validate the consumer chain, without being jailed for downtime on the provider. +After the introduction of Partial Set Security, the use of the soft opt-out mechanism is discouraged, and consumer chains are +encouraged to use the topN parameter to not force validators with little stake to validate the chain. +::: + ## ChangeRewardDenomProposal Proposal type used to mutate the set of denoms accepted by the provider as rewards. diff --git a/docs/docs/features/slashing.md b/docs/docs/features/slashing.md index 6db4c3ee0e..718c3cbad0 100644 --- a/docs/docs/features/slashing.md +++ b/docs/docs/features/slashing.md @@ -21,6 +21,9 @@ Instead of slashing, the provider will only jail offending validator for the dur [Slash throttling](../adrs/adr-002-throttle.md) (sometimes called jail throttling) mechanism ensures that only a fraction of the validator set can be jailed at any one time to prevent malicious consumer chains from harming the provider. ::: +Note that validators are only jailed for downtime on consumer chains that they opted-in to validate on, +or in the case of Top N chains, where they are automatically opted in by being in the Top N% of the validator set on the provider. + ## Equivocation Infractions Equivocation infractions are reported by external agents (e.g., relayers) that can submit to the provider evidence of light client or double signing attacks observed on a consumer chain. diff --git a/docs/docs/frequently-asked-questions.md b/docs/docs/frequently-asked-questions.md index ce76e4e24d..f648f8eac6 100644 --- a/docs/docs/frequently-asked-questions.md +++ b/docs/docs/frequently-asked-questions.md @@ -4,13 +4,9 @@ title: "Frequently Asked Questions" slug: /faq --- -## What is the meaning of Validator Set Replication? - -VSR simply means that the same validator set is used to secure both the provider and consumer chains. VSR is ensured through ICS protocol which keeps consumers up to date with the validator set of the provider. - ## What is a consumer chain? -Consumer chain is blockchain operated by the same validator operators as the provider chain. The ICS protocol ensures the validator set replication properties (informs consumer chain about the current state of the validator set on the provider) +Consumer chain is a blockchain operated by (a subset of) the validators of the provider chain. The ICS protocol ensures that the consumer chain gets information about which validators should run it (informs consumer chain about the current state of the validator set and the opted in validators for this consumer chain on the provider). Consumer chains are run on infrastructure (virtual or physical machines) distinct from the provider, have their own configurations and operating requirements. @@ -29,7 +25,7 @@ At the very least, the consumer chain could replace the validator set, remove th ## What happens to provider if consumer is down? Consumer chains do not impact the provider chain. -The ICS protocol is concerned only with validator set replication and the only communication that the provider requires from the consumer is information about validator activity (essentially keeping the provider informed about slash events). +The ICS protocol is concerned only with validator set management, and the only communication that the provider requires from the consumer is information about validator activity (essentially keeping the provider informed about slash events). ## Can I run the provider and consumer chains on the same machine? @@ -66,22 +62,15 @@ Validators can also be representatives but representatives are not required to r This feature discerns between validator operators (infrastructure) and governance representatives which further democratizes the ecosystem. This also reduces the pressure on validators to be involved in on-chain governance. -## Can validators opt-out of replicated security? - -At present, the validators cannot opt-out of validating consumer chains. - -There are multiple opt-out mechanisms under active research. - -## How does Equivocation Governance Slashing work? +## Can validators opt out of validating a consumer chain? -To avoid potential attacks directed at provider chain validators, a new mechanism was introduced: +A validator can always opt out from an Opt-In consumer chain. +A validator can only opt out from a Top N chain if the validator does not belong to the top N% validators. -When a validator double-signs on the consumer chain, a special type of slash packet is relayed to the provider chain. The provider will store information about the double signing validator and allow a governance proposal to be submitted. -If the double-signing proposal passes, the offending validator will be slashed on the provider chain and tombstoned. Tombstoning will permanently exclude the validator from the active set of the provider. +## How does Slashing work? -:::caution -An equivocation proposal cannot be submitted for a validator that did not double sign on any of the consumer chains. -::: +Validators that perform an equivocation or a light-client attack on a consumer chain are slashed on the provider chain. +We achieve this by submitting the proof of the equivocation or the light-client attack to the provider chain (see [slashing](features/slashing.md)). ## Can Consumer Chains perform Software Upgrades? @@ -101,9 +90,42 @@ To become a consumer chain use this [checklist](./consumer-development/onboardin Currently supported versions: -- Hermes 1.4.1 -- Support for the CCV module was added to the Go [relayer](https://github.com/cosmos/relayer) in v2.2.0 but v2.4.0 has significant performance fixes which makes it the earliest suggested version to use. +- Hermes 1.8.0 ## How does key delegation work in ICS? You can check the [Key Assignment Guide](./features/key-assignment.md) for specific instructions. + +## How does Partial Set Security work? + +Partial Set Security allows a provider chain to share only a subset of its validator set with a consumer chain. This subset can be determined by the top N% validators by voting power, or by validators opting in to validate the consumer chain. Partial Set Security allows for flexible tradeoffs between security, decentralization, and the budget a consumer chain spends on rewards to validators. + +See the [Partial Set Security](./features/partial-set-security.md) section for more information. + +## How does a validator know which consumers chains it has to validate? + +In order for a validator to keep track of all the chains it has to validate, the validator can use the +[`has-to-validate` query](validators/partial-set-security-for-validators.md#which-chains-does-a-validator-have-to-validate). + +## How many chains can a validator opt in to? + +There is **no** limit in the number of consumers chains a validator can choose to opt in to. + +## Can validators assign a consensus keys while a consumer-addition proposal is in voting period? +Yes, see the [Key Assignment Guide](./features/key-assignment.md) for more information. + +## Can validators assign a consensus key during the voting period for a consumer-addition proposal if they are not in the top N? +Yes. + +## Can validators opt in to an Opt-in or Top N chain after its consumer-addition proposal voting period is over but before the spawn time? +Yes. + +## Can validators opt in to an Opt-in chain after the spawn time if nobody else opted in? +No, the consumer chain will not be added if nobody opted in by the spawn time. At least one validator, regardless of its voting power, must opt in before the spawn time arrives in order for the chain can start. + +## Can all validators opt out of an Opt-in chain? +Yes, the consumer chain will halt with an ERR CONSENSUS FAILURE error after the opt-out message for the last validator is received. + +## Can validators set a commission rate for chains they have not opted in to? +Yes, and this is useful for validators that are not in the top N% of the provider chain, but might move into the top N% in the future. +By setting the commission rate ahead of time, they can make sure that they immediately have a commission rate of their choosing as soon as they are in the top N%. diff --git a/docs/docs/introduction/overview.md b/docs/docs/introduction/overview.md index aba31751e1..b9f870bfab 100644 --- a/docs/docs/introduction/overview.md +++ b/docs/docs/introduction/overview.md @@ -4,16 +4,19 @@ sidebar_position: 1 # Overview :::info -Replicated security (aka interchain security V1) is an open sourced IBC application which allows cosmos blockchains to lease their proof-of-stake security to one another. +Interchain Security is an open sourced IBC application which allows cosmos blockchains to lease their proof-of-stake security to one another.

-Replicated security allows anyone to launch a "consumer" blockchain using the same validator set as the "provider" blockchain by creating a governance proposal. If the proposal is accepted, provider chain validators start validating the consumer chain as well. Consumer chains will therefore inherit the full security and decentralization of the provider. +Interchain Security allows anyone to launch a "consumer" blockchain using a subset, or even the entire, validator set from the "provider" blockchain by creating a governance proposal. If the proposal is accepted, provider chain validators start validating the consumer chain as well. Consumer chains will therefore inherit security and decentralization from the provider. ::: -## Why Replicated Security? -- Full provider security. At launch, consumer chains are secured by the full validator set and market cap of the provider chain. + + +## Why Interchain Security? + +- The right amount of security for each application. Consumer chains can choose to inherit the whole validator set from the provider, or they can launch as an opt in chain where only a subset of the provider validators validate the consumer chain. This allows for a wide range of security tradeoffs. - Independent block-space. Transactions on consumer chains do not compete with any other applications. This means that there will be no unexpected congestion, and performance will generally be much better than on a shared smart contract platform such as Ethereum. - Projects keep majority of gas fees. Depending on configuration, these fees either go to the project’s community DAO, or can be used in the protocol in other ways. -- No validator search. Consumer chains do not have their own validator sets, and so do not need to find validators one by one. A governance vote will take place for a chain to get adopted by the provider validators which will encourage participation and signal strong buy-in into the project's long-term success. +- No validator search. Consumer chains do not have their own validator sets, and so do not need to find validators one by one. Validators from the provider chain validate on the consumer chain with their stake on the provider chain, earning additional rewards. For the consumer chain, this comes with the benefit of exposing their chain to the wider audience of the provider chain. - Instant sovereignty. Consumers can run arbitrary app logic similar to standalone chains. At any time in the future, a consumer chain can elect to become a completely standalone chain, with its own validator set. ## Core protocol diff --git a/docs/docs/introduction/terminology.md b/docs/docs/introduction/terminology.md index fd06174f92..dd9cd57602 100644 --- a/docs/docs/introduction/terminology.md +++ b/docs/docs/introduction/terminology.md @@ -16,7 +16,11 @@ Interchain Security is the Cosmos-specific category of Shared Security that uses ## Replicated Security -A particular protocol/implementation of Interchain Security that fully replicates the security and decentralization of a validator set across multiple blockchains. Replicated security has also been referred to as "Cross Chain Validation" or "Interchain Security V1", a legacy term for the same protocol. That is, a "provider chain" such as the Cosmos Hub can share its exact validator set with multiple consumer chains by communicating changes in its validator set over IBC. Note this documentation is focused on explaining the concepts from replicated security. +A particular protocol/implementation of Interchain Security that fully replicates the security and decentralization of a validator set across multiple blockchains. Replicated security has also been referred to as "Cross Chain Validation" or "Interchain Security V1", a legacy term for the same protocol. That is, a "provider chain" such as the Cosmos Hub can share its exact validator set with multiple consumer chains by communicating changes in its validator set over IBC. + +## Partial Set Security + +A major iteration of Interchain Security, also known as "Interchain Security V2". Partial Set Security allows a provider chain to share only a subset of its validator set with a consumer chain. This subset can be determined by the top N% validators by voting power, or by validators opting in to validate the consumer chain. Partial Set Security allows for more flexible security tradeoffs than Replicated Security. ## Mesh security diff --git a/docs/docs/validators/joining-testnet.md b/docs/docs/validators/joining-testnet.md index 09737cfb85..86a3dc2693 100644 --- a/docs/docs/validators/joining-testnet.md +++ b/docs/docs/validators/joining-testnet.md @@ -133,7 +133,7 @@ Additional scripts to setup your nodes are available [here](https://github.com/c :::tip Once you reach the active set on the provider chain, you will be required to validate all available consumer chains. -You can use the same consensus key on all consumer chains, or opt to use a different key on each consumer chain. +We strongly recommend that you assign a separate key for each consumer chain. Check out this [guide](../features/key-assignment.md) to learn more about key assignment in interchain security. ::: diff --git a/docs/docs/validators/partial-set-security-for-validators.md b/docs/docs/validators/partial-set-security-for-validators.md new file mode 100644 index 0000000000..2d6b2dd4a2 --- /dev/null +++ b/docs/docs/validators/partial-set-security-for-validators.md @@ -0,0 +1,175 @@ +--- +sidebar_position: 6 +--- + +# Partial Set Security + +[Partial Set Security](../features/partial-set-security.md) allows consumer chains to join as Opt-In or Top N. +Here, we show how a validator can opt in, opt out, or set a custom commission rate on a consumer chain, as well +as useful queries that a validator can use to figure out which chains it has to validate, etc. + +## Messages +### How to opt in to a consumer chain? + +:::warning +A validator is automatically opted in to a Top N chain if the validator belongs to the top N% of the validators on the provider chain. +::: + +In a Top N chain, a validator that does not belong to the top N% of the validators on the provider can still choose +to opt in to a consumer chain. In other words, validators can opt in, in both Opt-In and Top N chains. + +A validator can opt in to a consumer chain by issuing the following message: +```bash +interchain-security-pd tx provider opt-in +``` + +where +- `consumer-chain-id` is the string identifier of the consumer chain the validator wants to opt in to; +- `consumer-pub-key` corresponds to the public key the validator wants to use on the consumer chain, and it has the +following format `{"@type":"/cosmos.crypto.ed25519.PubKey","key":""}`. + +A validator can opt in to an existing consumer chain that is already running, or to a [proposed](../features/proposals.md) +consumer chain that is still being voted on. A validator can use the following command to retrieve the currently existing +consumer chains: +```bash +interchain-security-pd query provider list-consumer-chains +``` +and this command to see the currently proposed consumer chains: +```bash +interchain-security-pd query provider list-proposed-consumer-chains +``` + + +:::tip +By setting the `consumer-pub-key`, a validator can both opt in to a chain and assign a +public key on a consumer chain. Note that a validator can always [assign](../features/key-assignment.md) +a new consumer key at a later stage. The key-assignment [rules](../features/key-assignment.md#rules) +still apply when setting `consumer-pub-key` when opting in. +::: + +:::info +A validator is only eligible for consumer rewards from a consumer chain if the validator is opted into that chain. +::: + +### How to opt out from a consumer chain? +A validator can opt out from a consumer by issuing the following message: + +```bash +interchain-security-pd tx provider opt-out +``` +where +- `consumer-chain-id` is the string identifier of the consumer chain. + +:::warning +A validator cannot opt out from a Top N chain if it belongs to the top N% validators of the provider. +::: + +:::warning +If a validator moves from the Top N to outside of the top N% of the validators on the provider, it will **not** +be automatically opted-out. The validator has to manually opt out. +::: + +:::warning +A validator can stop its node on a consumer chain **only** after opting out and confirming through the `has-to-validate` +query (see [below](./partial-set-security-for-validators.md#which-chains-does-a-validator-have-to-validate)) that it does +not have to validate the consumer chain any longer. +::: + +:::warning +If all validators opt out from an Opt-In chain, the chain will halt with a consensus failure upon receiving the VSCPacket with an empty validator set. +::: + +### How to set specific per consumer chain commission rate? +A validator can choose to set a different commission rate on each of the consumer chains. +This can be done with the following command: +```bash +interchain-security-pd tx provider set-consumer-commission-rate +``` +where + +- `consumer-chain-id` is the string identifier of the consumer chain; +- `comission-rate` decimal in `[minRate, 1]` where `minRate` corresponds to the minimum commission rate set on the +provider chain (see `min_commission_rate` in `interchain-security-pd query staking params`). + + +If a validator does not set a commission rate on a consumer chain, the commission rate defaults to their commission rate on the provider chain. + +:::tip +Validators can set their commission rate even for consumer chains that they are not currently opted in on, and the commission rate will be applied when they opt in. This is particularly useful for Top N chains, where validators might be opted in automatically, +so validators can set the commission rate in advance. +::: + +:::tip +If a validator opts out and then back in, this will *not* reset their commission rate back to the default. Instead, their +set commission rate still applies. +::: + + +## Queries +Partial Set Security introduces a number of queries to assist validators determine which consumer chains they have to +validate, their commission rate per chain, etc. + +### Which chains does a validator have to validate? +Naturally, a validator is aware of the Opt-In chains it has to validate because in order to validate an Opt-In chain, +a validator has to manually opt in to the chain. This is not the case for Top N chains where a validator might be required +to validate such a chain without explicitly opting in if it belongs to the top N% of the validators on the provider. + +We introduce the following query: +```bash +interchain-security-pd query provider has-to-validate +``` +that can be used by validator with `provider-validator-address` address to retrieve the list of chains that it has to validate. + + +:::tip +As a validator, the list of chains returned by `has-to-validate` is the list of chains you **should** be validating to avoid +getting jailed for downtime. +::: + +### How do you know how much voting power you need to have to be in the top N for a chain? +This can be seen as part of the `list-consumer-chains` query: +```bash +interchain-security-pd query provider list-consumer-chains +``` +where the `min_power_in_top_N` field shows the minimum voting power required to be +automatically opted in to the chain. + +:::tip +`list-consumer-chains` shows the minimal voting power *right now*, but +the automatic opt-in happens only when epochs end on the provider. +In consequence, a validators power might be large enough to be automatically opted in +during an epoch, but if their power is sufficiently decreased before the epoch ends, +they will not be opted in automatically. +::: + + +### How to retrieve all the opted-in validators on a consumer chain? +With the following query: +```bash +interchain-security-pd query provider consumer-opted-in-validators +``` +we can see all the opted-in validators on `consumer-chain-id` that were manually or automatically opted in. + +### How to retrieve all the consumer validators on a consumer chain? +With the following query: +```bash +interchain-security-pd query provider consumer-validators +``` +we can see all the _consumer validators_ (i.e., validator set) of `consumer-chain-id`. The consumer validators are the +ones that are currently (or in the future, see warning) validating the consumer chain. A _consumer validator_ is an opted-in +validator but not vice versa. For example, an opted-in validator `V` might not be a consumer validator because `V` is +denylisted or because `V` is removed due to a validator-set cap. + +:::warning +The returned consumer validators from this query do not necessarily correspond to the validator set that is +validating the consumer chain at this exact moment. This is because the `VSCPacket` sent to a consumer chain might be +delayed and hence this query might return the validator set that the consumer chain would have at some future +point in time. +::: + +### How can we see the commission rate a validator has set on a consumer chain? +Using the following query: +```bash +interchain-security-pd query provider validator-consumer-commission-rate +``` +we retrieve the commission rate set by validator with `provider-validator-address` address on `consumer-chain-id`. \ No newline at end of file diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index b3a22cc03d..e73d5e2a21 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -42,7 +42,16 @@ const config = { versions: { current: { path: "/", - // banner: "current", + label: "main", + banner: "unreleased", + }, + "v4.2.0-docs": { + path: "/v4.2.0/", + label: "v4.2.0", + banner: "none", + }, + "v5.0.0": { + banner: "unreleased", }, }, remarkPlugins: [remarkMath], @@ -91,7 +100,14 @@ const config = { { type: "docsVersionDropdown", position: "left", - dropdownActiveClassDisabled: true, + dropdownActiveClassDisabled: false, + dropdownItemsAfter: [ + { + href: "https://cosmos.github.io/interchain-security/legacy", + label: "<= v3.x", + target: "_blank", + }, + ], }, ], }, @@ -211,7 +227,7 @@ const config = { toExtensions: ["html"], redirects: [ { - from: ["/main", "/master"], + from: ["/main"], to: "/", }, ], diff --git a/docs/figures/inactivevals_after.excalidraw b/docs/figures/inactivevals_after.excalidraw new file mode 100644 index 0000000000..9a618ddf8c --- /dev/null +++ b/docs/figures/inactivevals_after.excalidraw @@ -0,0 +1,847 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "id": "nJJZVzll88P_dmpDsWkuC", + "type": "rectangle", + "x": 551, + "y": -843, + "width": 657, + "height": 655, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a0", + "roundness": { + "type": 3 + }, + "seed": 951962170, + "version": 63, + "versionNonce": 1865032870, + "isDeleted": false, + "boundElements": null, + "updated": 1717506390574, + "link": null, + "locked": false + }, + { + "id": "fVs1LhHvrrvCK3ZhJRtu5", + "type": "text", + "x": 575, + "y": -891, + "width": 249.3000030517578, + "height": 45, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a1", + "roundness": null, + "seed": 129610534, + "version": 46, + "versionNonce": 1276535974, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Provider Chain", + "fontSize": 36, + "fontFamily": 1, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Provider Chain", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "_Dx7IQJkJzNifgDjIf2sI", + "type": "rectangle", + "x": 622, + "y": -764, + "width": 161, + "height": 281, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a2", + "roundness": { + "type": 3 + }, + "seed": 1049314490, + "version": 59, + "versionNonce": 1789968378, + "isDeleted": false, + "boundElements": [ + { + "id": "1QU4AFcgTvpCQQURDCxDZ", + "type": "arrow" + }, + { + "type": "text", + "id": "OyUuFa30MbHO4QszYQXEH" + } + ], + "updated": 1717508356543, + "link": null, + "locked": false + }, + { + "id": "OyUuFa30MbHO4QszYQXEH", + "type": "text", + "x": 667.3666648864746, + "y": -648.5, + "width": 70.26667022705078, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a2G", + "roundness": null, + "seed": 335756666, + "version": 18, + "versionNonce": 1919688890, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Staking\nModule", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "_Dx7IQJkJzNifgDjIf2sI", + "originalText": "Staking\nModule", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "type": "rectangle", + "version": 230, + "versionNonce": 188847418, + "index": "a4", + "isDeleted": false, + "id": "wJsk4gejRqDCjtFbAeg8G", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 962.5, + "y": -756.5, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "width": 186.99999999999997, + "height": 309, + "seed": 409738746, + "groupIds": [], + "frameId": null, + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "id": "A8ifOchQWi_H__sEvTMnW", + "type": "arrow" + }, + { + "id": "XBn8pRQaZVQe5gai59xYl", + "type": "arrow" + } + ], + "updated": 1717507815940, + "link": null, + "locked": false + }, + { + "type": "rectangle", + "version": 351, + "versionNonce": 357216442, + "index": "a5", + "isDeleted": false, + "id": "n5HV8y4tI6DZYWWA1Koq6", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 620.5, + "y": -376.5, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "width": 164, + "height": 120.00000000000003, + "seed": 1248958374, + "groupIds": [], + "frameId": null, + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "TKqZQfAcUP-6Q6EoH8fp0" + }, + { + "id": "QVrMGeKQYVvkrmDV5wKWR", + "type": "arrow" + } + ], + "updated": 1717508356543, + "link": null, + "locked": false + }, + { + "id": "TKqZQfAcUP-6Q6EoH8fp0", + "type": "text", + "x": 652.0166664123535, + "y": -329, + "width": 100.96666717529297, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a6", + "roundness": null, + "seed": 438334118, + "version": 22, + "versionNonce": 2019293562, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "CometBFT", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "n5HV8y4tI6DZYWWA1Koq6", + "originalText": "CometBFT", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "FPk9JragWk96YKRlFekY6", + "type": "rectangle", + "x": 1026, + "y": -678, + "width": 108.00000000000003, + "height": 98, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a8", + "roundness": { + "type": 3 + }, + "seed": 580928678, + "version": 174, + "versionNonce": 683525946, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "R6sc8M7CuGEvv7N7-fcTZ" + }, + { + "id": "1QU4AFcgTvpCQQURDCxDZ", + "type": "arrow" + }, + { + "id": "A8ifOchQWi_H__sEvTMnW", + "type": "arrow" + } + ], + "updated": 1717507761939, + "link": null, + "locked": false + }, + { + "id": "R6sc8M7CuGEvv7N7-fcTZ", + "type": "text", + "x": 1034.849998474121, + "y": -666.5, + "width": 90.30000305175781, + "height": 75, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a9", + "roundness": null, + "seed": 758773690, + "version": 153, + "versionNonce": 596469030, + "isDeleted": false, + "boundElements": null, + "updated": 1717507759332, + "link": null, + "locked": false, + "text": "Power \nShaping\n& Opt In", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "FPk9JragWk96YKRlFekY6", + "originalText": "Power Shaping\n& Opt In", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "1QU4AFcgTvpCQQURDCxDZ", + "type": "arrow", + "x": 784, + "y": -617.9538520826802, + "width": 240, + "height": 19.20103304326051, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aA", + "roundness": { + "type": 2 + }, + "seed": 75530874, + "version": 385, + "versionNonce": 598135718, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "teEeVARH2zRlZXGyzB2PV" + } + ], + "updated": 1717507759332, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 240, + -19.20103304326051 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "_Dx7IQJkJzNifgDjIf2sI", + "focus": 0.08197485638165014, + "gap": 1 + }, + "endBinding": { + "elementId": "FPk9JragWk96YKRlFekY6", + "focus": 0.23696682464454974, + "gap": 2 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "teEeVARH2zRlZXGyzB2PV", + "type": "text", + "x": 837.0583343505859, + "y": -639.5, + "width": 99.88333129882812, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aB", + "roundness": null, + "seed": 918244474, + "version": 27, + "versionNonce": 206748218, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Bonded\nValidators", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "1QU4AFcgTvpCQQURDCxDZ", + "originalText": "Bonded\nValidators", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "9Z_qOWKQyxwUvelhZMZx6", + "type": "text", + "x": 1011, + "y": -751, + "width": 78.66666412353516, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aE", + "roundness": null, + "seed": 91824166, + "version": 99, + "versionNonce": 207872422, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Provider\nModule", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "top", + "containerId": null, + "originalText": "Provider\nModule", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "A8ifOchQWi_H__sEvTMnW", + "type": "arrow", + "x": 1134, + "y": -632.7473377850915, + "width": 185, + "height": 10.747337785091531, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aF", + "roundness": { + "type": 2 + }, + "seed": 157350886, + "version": 351, + "versionNonce": 1955289658, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "IWrcqs7yN7FdMaMGcNDj4" + } + ], + "updated": 1717507763008, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 185, + 10.747337785091531 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "FPk9JragWk96YKRlFekY6", + "focus": -0.1320442396210268, + "gap": 1 + }, + "endBinding": { + "elementId": "zY_dSGPd9zunChgVkNDpR", + "focus": -0.020248008412827926, + "gap": 1.5583343505859375 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "IWrcqs7yN7FdMaMGcNDj4", + "type": "text", + "x": 1190.216667175293, + "y": -647, + "width": 67.56666564941406, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aG", + "roundness": null, + "seed": 1111293542, + "version": 19, + "versionNonce": 1166078906, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Shaped\nValSet", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "A8ifOchQWi_H__sEvTMnW", + "originalText": "Shaped\nValSet", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "zY_dSGPd9zunChgVkNDpR", + "type": "text", + "x": 1320.558334350586, + "y": -645, + "width": 84.88333129882812, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aH", + "roundness": null, + "seed": 359543462, + "version": 97, + "versionNonce": 589863290, + "isDeleted": false, + "boundElements": [ + { + "id": "A8ifOchQWi_H__sEvTMnW", + "type": "arrow" + } + ], + "updated": 1717507761940, + "link": null, + "locked": false, + "text": "sent to\nconsumer", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "top", + "containerId": null, + "originalText": "sent to\nconsumer", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "type": "rectangle", + "version": 259, + "versionNonce": 827676730, + "index": "aI", + "isDeleted": false, + "id": "kTEf4qbgYHvfyWHxD6yV2", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 977, + "y": -555, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "width": 152.00000000000006, + "height": 100, + "seed": 1312320038, + "groupIds": [], + "frameId": null, + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "TKt49fH0utbl-oDqZWAHv" + }, + { + "id": "XBn8pRQaZVQe5gai59xYl", + "type": "arrow" + }, + { + "id": "QVrMGeKQYVvkrmDV5wKWR", + "type": "arrow" + } + ], + "updated": 1717507832443, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 273, + "versionNonce": 640336678, + "index": "aJ", + "isDeleted": false, + "id": "TKt49fH0utbl-oDqZWAHv", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 987.3499984741211, + "y": -542.5, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "width": 131.3000030517578, + "height": 75, + "seed": 489960806, + "groupIds": [], + "frameId": null, + "roundness": null, + "boundElements": [], + "updated": 1717507777794, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 1, + "text": "Filter to\nsmall set of \nvalidators", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "kTEf4qbgYHvfyWHxD6yV2", + "originalText": "Filter to\nsmall set of validators", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "XBn8pRQaZVQe5gai59xYl", + "type": "arrow", + "x": 980, + "y": -633, + "width": 15, + "height": 78, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aK", + "roundness": { + "type": 2 + }, + "seed": 2081760186, + "version": 43, + "versionNonce": 557255654, + "isDeleted": false, + "boundElements": null, + "updated": 1717507819360, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 15, + 78 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "wJsk4gejRqDCjtFbAeg8G", + "focus": 0.5684407679100983, + "gap": 1 + }, + "endBinding": { + "elementId": "kTEf4qbgYHvfyWHxD6yV2", + "focus": -0.5651392632524705, + "gap": 1 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "QVrMGeKQYVvkrmDV5wKWR", + "type": "arrow", + "x": 981, + "y": -466, + "width": 196, + "height": 106, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aL", + "roundness": { + "type": 2 + }, + "seed": 390002426, + "version": 59, + "versionNonce": 832345722, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "Usz338HAejcFqJG1vmJ4x" + } + ], + "updated": 1717507912037, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -196, + 106 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "kTEf4qbgYHvfyWHxD6yV2", + "focus": -0.000672043010752688, + "gap": 1 + }, + "endBinding": { + "elementId": "n5HV8y4tI6DZYWWA1Koq6", + "focus": 0.01070799921768042, + "gap": 1 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "Usz338HAejcFqJG1vmJ4x", + "type": "text", + "x": 827.5499992370605, + "y": -425.5, + "width": 110.9000015258789, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aM", + "roundness": null, + "seed": 920641702, + "version": 12, + "versionNonce": 1488639910, + "isDeleted": false, + "boundElements": null, + "updated": 1717507911327, + "link": null, + "locked": false, + "text": "ValUpdates", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "QVrMGeKQYVvkrmDV5wKWR", + "originalText": "ValUpdates", + "autoResize": true, + "lineHeight": 1.25 + } + ], + "appState": { + "gridSize": null, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/docs/figures/inactivevals_after.png b/docs/figures/inactivevals_after.png new file mode 100644 index 0000000000..fb9e862c02 Binary files /dev/null and b/docs/figures/inactivevals_after.png differ diff --git a/docs/figures/inactivevals_before.excalidraw b/docs/figures/inactivevals_before.excalidraw new file mode 100644 index 0000000000..ea1d06352a --- /dev/null +++ b/docs/figures/inactivevals_before.excalidraw @@ -0,0 +1,659 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "id": "nJJZVzll88P_dmpDsWkuC", + "type": "rectangle", + "x": 551, + "y": -843, + "width": 657, + "height": 655, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a0", + "roundness": { + "type": 3 + }, + "seed": 951962170, + "version": 63, + "versionNonce": 1865032870, + "isDeleted": false, + "boundElements": null, + "updated": 1717506390574, + "link": null, + "locked": false + }, + { + "id": "fVs1LhHvrrvCK3ZhJRtu5", + "type": "text", + "x": 575, + "y": -891, + "width": 249.3000030517578, + "height": 45, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "dotted", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a1", + "roundness": null, + "seed": 129610534, + "version": 46, + "versionNonce": 1276535974, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Provider Chain", + "fontSize": 36, + "fontFamily": 1, + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Provider Chain", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "_Dx7IQJkJzNifgDjIf2sI", + "type": "rectangle", + "x": 622, + "y": -764, + "width": 161, + "height": 281, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a2", + "roundness": { + "type": 3 + }, + "seed": 1049314490, + "version": 58, + "versionNonce": 250933030, + "isDeleted": false, + "boundElements": [ + { + "id": "SPm0CjdkwnTk8Wfol8gqy", + "type": "arrow" + }, + { + "id": "1QU4AFcgTvpCQQURDCxDZ", + "type": "arrow" + }, + { + "type": "text", + "id": "OyUuFa30MbHO4QszYQXEH" + } + ], + "updated": 1717506907807, + "link": null, + "locked": false + }, + { + "id": "OyUuFa30MbHO4QszYQXEH", + "type": "text", + "x": 667.3666648864746, + "y": -648.5, + "width": 70.26667022705078, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a2G", + "roundness": null, + "seed": 335756666, + "version": 18, + "versionNonce": 1919688890, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Staking\nModule", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "_Dx7IQJkJzNifgDjIf2sI", + "originalText": "Staking\nModule", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "type": "rectangle", + "version": 133, + "versionNonce": 1967865830, + "index": "a4", + "isDeleted": false, + "id": "wJsk4gejRqDCjtFbAeg8G", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 966.5, + "y": -764.5, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "width": 161, + "height": 281, + "seed": 409738746, + "groupIds": [], + "frameId": null, + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "id": "A8ifOchQWi_H__sEvTMnW", + "type": "arrow" + } + ], + "updated": 1717507105162, + "link": null, + "locked": false + }, + { + "type": "rectangle", + "version": 349, + "versionNonce": 1873924346, + "index": "a5", + "isDeleted": false, + "id": "n5HV8y4tI6DZYWWA1Koq6", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 620.5, + "y": -376.5, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "width": 164, + "height": 120.00000000000003, + "seed": 1248958374, + "groupIds": [], + "frameId": null, + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "TKqZQfAcUP-6Q6EoH8fp0" + }, + { + "id": "SPm0CjdkwnTk8Wfol8gqy", + "type": "arrow" + } + ], + "updated": 1717506820805, + "link": null, + "locked": false + }, + { + "id": "TKqZQfAcUP-6Q6EoH8fp0", + "type": "text", + "x": 652.0166664123535, + "y": -329, + "width": 100.96666717529297, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a6", + "roundness": null, + "seed": 438334118, + "version": 22, + "versionNonce": 2019293562, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "CometBFT", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "n5HV8y4tI6DZYWWA1Koq6", + "originalText": "CometBFT", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "SPm0CjdkwnTk8Wfol8gqy", + "type": "arrow", + "x": 697, + "y": -480, + "width": 0, + "height": 106, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a7", + "roundness": { + "type": 2 + }, + "seed": 906345786, + "version": 53, + "versionNonce": 648670650, + "isDeleted": false, + "boundElements": null, + "updated": 1717506825727, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 0, + 106 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "_Dx7IQJkJzNifgDjIf2sI", + "focus": 0.06832298136645963, + "gap": 3 + }, + "endBinding": { + "elementId": "n5HV8y4tI6DZYWWA1Koq6", + "focus": -0.06707317073170732, + "gap": 1 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "FPk9JragWk96YKRlFekY6", + "type": "rectangle", + "x": 995, + "y": -654, + "width": 108.00000000000003, + "height": 98, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a8", + "roundness": { + "type": 3 + }, + "seed": 580928678, + "version": 111, + "versionNonce": 1002770426, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "R6sc8M7CuGEvv7N7-fcTZ" + }, + { + "id": "1QU4AFcgTvpCQQURDCxDZ", + "type": "arrow" + } + ], + "updated": 1717506889152, + "link": null, + "locked": false + }, + { + "id": "R6sc8M7CuGEvv7N7-fcTZ", + "type": "text", + "x": 1003.8499984741211, + "y": -642.5, + "width": 90.30000305175781, + "height": 75, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a9", + "roundness": null, + "seed": 758773690, + "version": 91, + "versionNonce": 1184232230, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Power \nShaping\n& Opt In", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "FPk9JragWk96YKRlFekY6", + "originalText": "Power Shaping\n& Opt In", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "1QU4AFcgTvpCQQURDCxDZ", + "type": "arrow", + "x": 781, + "y": -613, + "width": 212, + "height": 3, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aA", + "roundness": { + "type": 2 + }, + "seed": 75530874, + "version": 55, + "versionNonce": 700245990, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "teEeVARH2zRlZXGyzB2PV" + } + ], + "updated": 1717506903639, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 212, + -3 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "_Dx7IQJkJzNifgDjIf2sI", + "focus": 0.08197485638165014, + "gap": 1 + }, + "endBinding": { + "elementId": "FPk9JragWk96YKRlFekY6", + "focus": 0.23696682464454974, + "gap": 2 + }, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "teEeVARH2zRlZXGyzB2PV", + "type": "text", + "x": 837.0583343505859, + "y": -639.5, + "width": 99.88333129882812, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aB", + "roundness": null, + "seed": 918244474, + "version": 27, + "versionNonce": 206748218, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Bonded\nValidators", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "1QU4AFcgTvpCQQURDCxDZ", + "originalText": "Bonded\nValidators", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "9Z_qOWKQyxwUvelhZMZx6", + "type": "text", + "x": 1011, + "y": -751, + "width": 78.66666412353516, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aE", + "roundness": null, + "seed": 91824166, + "version": 99, + "versionNonce": 207872422, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Provider\nModule", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "top", + "containerId": null, + "originalText": "Provider\nModule", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "A8ifOchQWi_H__sEvTMnW", + "type": "arrow", + "x": 1129, + "y": -622, + "width": 190, + "height": 0, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aF", + "roundness": { + "type": 2 + }, + "seed": 157350886, + "version": 83, + "versionNonce": 738572602, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "IWrcqs7yN7FdMaMGcNDj4" + } + ], + "updated": 1717507110279, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 190, + 0 + ] + ], + "lastCommittedPoint": null, + "startBinding": { + "elementId": "wJsk4gejRqDCjtFbAeg8G", + "focus": 0.014234875444839857, + "gap": 1.5 + }, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": "arrow" + }, + { + "id": "IWrcqs7yN7FdMaMGcNDj4", + "type": "text", + "x": 1190.216667175293, + "y": -647, + "width": 67.56666564941406, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aG", + "roundness": null, + "seed": 1111293542, + "version": 19, + "versionNonce": 1166078906, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "Shaped\nValSet", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "A8ifOchQWi_H__sEvTMnW", + "originalText": "Shaped\nValSet", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "zY_dSGPd9zunChgVkNDpR", + "type": "text", + "x": 1320.558334350586, + "y": -645, + "width": 84.88333129882812, + "height": 50, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aH", + "roundness": null, + "seed": 359543462, + "version": 96, + "versionNonce": 100973798, + "isDeleted": false, + "boundElements": null, + "updated": 1717507131314, + "link": null, + "locked": false, + "text": "sent to\nconsumer", + "fontSize": 20, + "fontFamily": 1, + "textAlign": "center", + "verticalAlign": "top", + "containerId": null, + "originalText": "sent to\nconsumer", + "autoResize": true, + "lineHeight": 1.25 + } + ], + "appState": { + "gridSize": null, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/docs/figures/inactivevals_before.png b/docs/figures/inactivevals_before.png new file mode 100644 index 0000000000..ffbcd584b8 Binary files /dev/null and b/docs/figures/inactivevals_before.png differ diff --git a/docs/sync_versions.sh b/docs/sync_versions.sh new file mode 100755 index 0000000000..977a69700c --- /dev/null +++ b/docs/sync_versions.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# this script builds the docs for all versions in versions.json +# all the versions are included in the docs webpage + +# exit if there are uncommitted changes +if git diff-index --quiet HEAD --; then + # initial branch + COMMIT=$(git rev-parse HEAD) + for version in $(jq -r .[] versions.json); do + echo "Building docusaurus $version docs ..." + git checkout $version + npm cache clean --force && npm install && npm run docusaurus docs:version $version + + # versions.json / package-lock.json, get mangled by Docusarus causing problems + rm versions.json package-lock.json + done + + # return to initial branch but keep the files created by Docusarus in the loop above + (git reset --hard && git checkout $COMMIT) + + # copy figures so they are available to all versioned docs + cp -R figures ./versioned_docs/ +else + + echo "Please commit all changes before running this script" + exit 1 +fi + + diff --git a/docs/versions.json b/docs/versions.json new file mode 100644 index 0000000000..bba35efde5 --- /dev/null +++ b/docs/versions.json @@ -0,0 +1,4 @@ +[ + "v4.2.0-docs", + "v5.0.0" +] \ No newline at end of file diff --git a/go.mod b/go.mod index 033903e160..35be2495a4 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( golang.org/x/net v0.23.0 // indirect golang.org/x/sys v0.18.0 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 google.golang.org/protobuf v1.33.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -80,7 +80,7 @@ require ( github.com/google/orderedcode v0.0.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/googleapis/gax-go/v2 v2.12.3 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect @@ -134,10 +134,10 @@ require ( github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/oauth2 v0.16.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/api v0.162.0 // indirect + google.golang.org/api v0.171.0 // indirect google.golang.org/appengine v1.6.8 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -162,7 +162,7 @@ require ( github.com/informalsystems/itf-go v0.0.1 github.com/spf13/viper v1.18.2 golang.org/x/mod v0.15.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 + google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 ) require ( @@ -200,16 +200,16 @@ require ( github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/mock v0.2.0 // indirect go.uber.org/multierr v1.10.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect gotest.tools/v3 v3.5.1 // indirect ) diff --git a/go.sum b/go.sum index fab474f5d0..6de4eeaa49 100644 --- a/go.sum +++ b/go.sum @@ -314,8 +314,6 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -422,8 +420,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= @@ -619,8 +615,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= 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.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/gax-go/v2 v2.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA= +github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= @@ -1047,18 +1043,18 @@ 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/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= -go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= -go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= -go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= -go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= -go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1217,8 +1213,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= -golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= 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= @@ -1480,8 +1476,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= -google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= +google.golang.org/api v0.171.0 h1:w174hnBPqut76FzW5Qaupt7zY8Kql6fiVjgys4f58sU= +google.golang.org/api v0.171.0/go.mod h1:Hnq5AHm4OTMt2BUVjael2CWZFD6vksJdWCWiUAmjC9o= 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= @@ -1600,10 +1596,10 @@ google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= -google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 h1:x9PwdEgd11LgK+orcck69WVRo7DezSO4VUMPI4xpc8A= -google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014/go.mod h1:rbHMSEDyoYX62nRVLOCc4Qt1HbsdytAYoVwgjiOhF3I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c h1:NUsgEN92SQQqzfA+YtqYNqYmB3DMMYLlIwUZAQFVFbo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 h1:rIo7ocm2roD9DcFIX67Ym8icoGCKSARAiPljFhh5suQ= +google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2/go.mod h1:O1cOfN1Cy6QEYr7VxtjOyP5AdAuR0aJ/MYZaaof623Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c h1:lfpJ/2rWPa/kJgxyyXM8PrNnfCzcmxJ265mADgwmvLI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= 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= @@ -1645,8 +1641,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= 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= diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 5e573d1a8a..339d94a833 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -14,6 +14,7 @@ import "tendermint/crypto/keys.proto"; import "cosmos/evidence/v1beta1/evidence.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; // // Note any type defined in this file is ONLY used internally to the provider CCV module. @@ -86,6 +87,25 @@ message ConsumerAdditionProposal { // chain. it is most relevant for chains performing a sovereign to consumer // changeover in order to maintain the existing ibc transfer channel string distribution_transmission_channel = 14; + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + uint32 top_N = 15; + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + uint32 validators_power_cap = 16; + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + uint32 validator_set_cap = 17; + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + repeated string allowlist = 18; + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + repeated string denylist = 19; } // ConsumerRemovalProposal is a governance proposal on the provider chain to @@ -108,6 +128,37 @@ message ConsumerRemovalProposal { [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; } +// ConsumerModificationProposal is a governance proposal on the provider chain to modify parameters of a running +// consumer chain. If it passes, the consumer chain's state is updated to take into account the newest params. +message ConsumerModificationProposal { + // the title of the proposal + string title = 1; + // the description of the proposal + string description = 2; + // the chain-id of the consumer chain to be modified + string chain_id = 3; + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + uint32 top_N = 4; + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + uint32 validators_power_cap = 5; + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + uint32 validator_set_cap = 6; + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + repeated string allowlist = 7; + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + repeated string denylist = 8; +} + + // EquivocationProposal is a governance proposal on the provider chain to // punish a validator for equivocation on a consumer chain. // @@ -118,7 +169,7 @@ message EquivocationProposal { option deprecated = true; // the title of the proposal string title = 1; -// the description of the proposal + // the description of the proposal string description = 2; // the list of equivocations that will be processed repeated cosmos.evidence.v1beta1.Equivocation equivocations = 3; @@ -317,4 +368,14 @@ message ConsumerValidator { int64 power = 2; // public key the validator uses on the consumer chain during this epoch tendermint.crypto.PublicKey consumer_public_key = 3; -} \ No newline at end of file +} +// ConsumerRewardsAllocation stores the rewards allocated by a consumer chain +// to the consumer rewards pool. It is used to allocate the tokens to the consumer +// opted-in validators and the community pool during BeginBlock. +message ConsumerRewardsAllocation { + repeated cosmos.base.v1beta1.DecCoin rewards = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" + ]; +} diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 580e43102e..9e922a6096 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -10,6 +10,8 @@ import "interchain_security/ccv/provider/v1/provider.proto"; import "interchain_security/ccv/v1/shared_consumer.proto"; import "interchain_security/ccv/v1/wire.proto"; import "tendermint/crypto/keys.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; service Query { // ConsumerGenesis queries the genesis state needed to start a consumer chain @@ -100,12 +102,48 @@ service Query { "/interchain_security/ccv/provider/params"; } + // QueryConsumerChainOptedInValidators returns a list of validators consensus addresses + // that opted-in to the given consumer chain + rpc QueryConsumerChainOptedInValidators( + QueryConsumerChainOptedInValidatorsRequest) + returns (QueryConsumerChainOptedInValidatorsResponse) { + option (google.api.http).get = + "/interchain_security/ccv/provider/opted_in_validators/{chain_id}"; + } + + // QueryConsumerChainsValidatorHasToValidate returns a list of consumer chains + // that a given validator must validate + rpc QueryConsumerChainsValidatorHasToValidate( + QueryConsumerChainsValidatorHasToValidateRequest) + returns (QueryConsumerChainsValidatorHasToValidateResponse) { + option (google.api.http).get = + "/interchain_security/ccv/provider/consumer_chains_per_validator/{provider_address}"; + } + + // QueryValidatorConsumerCommissionRate returns the commission rate a given + // validator charges on a given consumer chain + rpc QueryValidatorConsumerCommissionRate( + QueryValidatorConsumerCommissionRateRequest) + returns (QueryValidatorConsumerCommissionRateResponse) { + option (google.api.http).get = + "/interchain_security/ccv/provider/consumer_commission_rate/{chain_id}/{provider_address}"; + } + // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID rpc QueryOldestUnconfirmedVsc(QueryOldestUnconfirmedVscRequest) returns (QueryOldestUnconfirmedVscResponse) { option (google.api.http).get = "/interchain_security/ccv/provider/oldest_unconfirmed_vsc/{chain_id}"; } + + // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID + // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment + // because a VSCPacket could be delayed to be delivered on the consumer chain. + rpc QueryConsumerValidators(QueryConsumerValidatorsRequest) + returns (QueryConsumerValidatorsResponse) { + option (google.api.http).get = + "/interchain_security/ccv/provider/consumer_validators/{chain_id}"; + } } message QueryConsumerGenesisRequest { string chain_id = 1; } @@ -134,6 +172,21 @@ message QueryConsumerChainStopProposalsResponse { message Chain { string chain_id = 1; string client_id = 2; + // If chain with `chainID` is a Top-N chain, i.e., enforces at least one validator to validate chain `chainID` + uint32 top_N = 3; + // If the chain is a Top-N chain, this is the minimum power required to be in the top N. + // Otherwise, this is -1. + int64 min_power_in_top_N = 4; + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. + uint32 validators_power_cap = 5; + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + uint32 validator_set_cap = 6; + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + repeated string allowlist = 7; + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + repeated string denylist = 8; } message QueryValidatorConsumerAddrRequest { @@ -219,9 +272,60 @@ message QueryParamsResponse { Params params = 1 [(gogoproto.nullable) = false]; } +message QueryConsumerChainOptedInValidatorsRequest { + string chain_id = 1; +} + +message QueryConsumerChainOptedInValidatorsResponse { + // The consensus addresses of the validators on the provider chain + repeated string validators_provider_addresses = 1; +} + +message QueryConsumerValidatorsRequest { + string chain_id = 1; +} + +message QueryConsumerValidatorsValidator { + // The consensus address of the validator on the provider chain + string provider_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // The consumer public key of the validator used on the consumer chain + tendermint.crypto.PublicKey consumer_key = 2; + // The power of the validator used on the consumer chain + int64 power = 3; +} + +message QueryConsumerValidatorsResponse { + repeated QueryConsumerValidatorsValidator validators = 1; +} + +message QueryConsumerChainsValidatorHasToValidateRequest { + // The consensus address of the validator on the provider chain + string provider_address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; +} + +message QueryConsumerChainsValidatorHasToValidateResponse { + repeated string consumer_chain_ids = 1; +} + +message QueryValidatorConsumerCommissionRateRequest { + string chain_id = 1; + // The consensus address of the validator on the provider chain + string provider_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; +} + +message QueryValidatorConsumerCommissionRateResponse { + // The rate to charge delegators on the consumer chain, as a fraction + string rate = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + message QueryOldestUnconfirmedVscRequest { string chain_id = 1; } message QueryOldestUnconfirmedVscResponse { interchain_security.ccv.provider.v1.VscSendTimestamp vsc_send_timestamp = 1 [ (gogoproto.nullable) = false ]; -} \ No newline at end of file +} diff --git a/proto/interchain_security/ccv/provider/v1/tx.proto b/proto/interchain_security/ccv/provider/v1/tx.proto index 2b14e77dec..4a04fc7a36 100644 --- a/proto/interchain_security/ccv/provider/v1/tx.proto +++ b/proto/interchain_security/ccv/provider/v1/tx.proto @@ -23,11 +23,13 @@ service Msg { rpc AssignConsumerKey(MsgAssignConsumerKey) returns (MsgAssignConsumerKeyResponse); rpc SubmitConsumerMisbehaviour(MsgSubmitConsumerMisbehaviour) returns (MsgSubmitConsumerMisbehaviourResponse); rpc SubmitConsumerDoubleVoting(MsgSubmitConsumerDoubleVoting) returns (MsgSubmitConsumerDoubleVotingResponse); - - rpc ConsumerAddition(MsgConsumerAddition)returns (MsgConsumerAdditionResponse); + rpc ConsumerAddition(MsgConsumerAddition) returns (MsgConsumerAdditionResponse); rpc ConsumerRemoval(MsgConsumerRemoval) returns (MsgConsumerRemovalResponse); - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc OptIn(MsgOptIn) returns (MsgOptInResponse); + rpc OptOut(MsgOptOut) returns (MsgOptOutResponse); + rpc SetConsumerCommissionRate(MsgSetConsumerCommissionRate) returns (MsgSetConsumerCommissionRateResponse); + rpc ConsumerModification(MsgConsumerModification) returns (MsgConsumerModificationResponse); } @@ -101,7 +103,7 @@ message MsgUpdateParamsResponse {} // MsgConsumerAddition defines the message used to spawn a new consumer chain using a v1 governance proposal. -// If it passes, then all validators on the provider chain are expected to validate +// If it passes, then all ˝validators on the provider chain are expected to validate // the consumer chain at spawn time or get slashed. // It is recommended that spawn time occurs after the proposal end time. // @@ -160,9 +162,27 @@ message MsgConsumerAddition { // chain. it is most relevant for chains performing a sovereign to consumer // changeover in order to maintan the existing ibc transfer channel string distribution_transmission_channel = 12; - + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + uint32 top_N = 13; + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + uint32 validators_power_cap = 14; + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + uint32 validator_set_cap = 15; + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + repeated string allowlist = 16; + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + repeated string denylist = 17; // signer address - string authority = 13 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string authority = 18 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgConsumerAdditionResponse defines response type for MsgConsumerAddition messages @@ -184,7 +204,6 @@ message MsgConsumerRemoval { // stop their consumer chain validator node google.protobuf.Timestamp stop_time = 2 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; - // signer address string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -210,3 +229,88 @@ message MsgChangeRewardDenoms { // MsgChangeRewardDenomsResponse defines response type for MsgChangeRewardDenoms messages message MsgChangeRewardDenomsResponse {} +message MsgOptIn { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // the chain id of the consumer chain to opt in to + string chain_id = 1; + // the validator address on the provider + string provider_addr = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // (optional) The consensus public key to use on the consumer in json string format corresponding to proto-any, + // for example `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`. + // This field is optional and can remain empty (i.e., `consumer_key = ""`). A validator can always change the + // consumer public key at a later stage by issuing a `MsgAssignConsumerKey` message. + string consumer_key = 3; +} + +message MsgOptInResponse {} + +message MsgOptOut { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // the chain id of the consumer chain to opt out from + string chain_id = 1; + // the validator address on the provider + string provider_addr = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; +} + +message MsgOptOutResponse {} + +// MsgSetConsumerCommissionRate allows validators to set +// a per-consumer chain commission rate +message MsgSetConsumerCommissionRate { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + // The validator address on the provider + string provider_addr = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + // The chain id of the consumer chain to set a commission rate + string chain_id = 2; + // The rate to charge delegators on the consumer chain, as a fraction + // TODO: migrate rate from sdk.Dec to math.LegacyDec + string rate = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + } + + +message MsgSetConsumerCommissionRateResponse {} + +// MsgConsumerModification message contains a governance proposal on the provider chain to +// modify a running consumer chain. If it passes, the consumer chain's +// parameters are updated. +// +// Note: this replaces ConsumerModificationProposal which is deprecated and will be removed soon +message MsgConsumerModification { + // the title of the proposal + string title = 1; + // the description of the proposal + string description = 2; + // the chain-id of the consumer chain to be modified + string chain_id = 3; + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + uint32 top_N = 4; + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + uint32 validators_power_cap = 5; + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + uint32 validator_set_cap = 6; + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + repeated string allowlist = 7; + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + repeated string denylist = 8; + // signer address + string authority = 9 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +message MsgConsumerModificationResponse {} diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh old mode 100644 new mode 100755 diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 8821aa40e5..752812e1ae 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -258,6 +258,11 @@ type SubmitConsumerAdditionProposalAction struct { SpawnTime uint InitialHeight clienttypes.Height DistributionChannel string + TopN uint32 + ValidatorsPowerCap uint32 + ValidatorSetCap uint32 + Allowlist []string + Denylist []string } func (tr Chain) submitConsumerAdditionProposal( @@ -282,6 +287,11 @@ func (tr Chain) submitConsumerAdditionProposal( UnbondingPeriod: params.UnbondingPeriod, Deposit: fmt.Sprint(action.Deposit) + `stake`, DistributionTransmissionChannel: action.DistributionChannel, + TopN: action.TopN, + ValidatorsPowerCap: action.ValidatorsPowerCap, + ValidatorSetCap: action.ValidatorSetCap, + Allowlist: action.Allowlist, + Denylist: action.Denylist, } bz, err := json.Marshal(prop) @@ -295,15 +305,19 @@ func (tr Chain) submitConsumerAdditionProposal( } //#nosec G204 -- bypass unsafe quoting warning (no production code) - bz, err = tr.target.ExecCommand( - "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/temp-proposal.json"), - ).CombinedOutput() + cmd := tr.target.ExecCommand( + "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/temp-proposal.json")) + bz, err = cmd.CombinedOutput() + if verbose { + log.Println("submitConsumerAdditionProposal cmd: ", cmd.String()) + } + if err != nil { log.Fatal(err, "\n", string(bz)) } // CONSUMER ADDITION PROPOSAL - cmd := tr.target.ExecCommand( + cmd = tr.target.ExecCommand( tr.testConfig.chainConfigs[action.Chain].BinaryName, "tx", "gov", "submit-legacy-proposal", "consumer-addition", "/temp-proposal.json", `--from`, `validator`+fmt.Sprint(action.From), @@ -1439,7 +1453,6 @@ func (tr Chain) delegateTokens( "tx", "staking", "delegate", validatorAddress, fmt.Sprint(action.Amount)+`stake`, - `--from`, `validator`+fmt.Sprint(action.From), `--chain-id`, string(tr.testConfig.chainConfigs[action.Chain].ChainId), `--home`, tr.getValidatorHome(action.Chain, action.From), @@ -2234,6 +2247,109 @@ func (tr Chain) startConsumerEvidenceDetector( tr.waitBlocks("provi", 10, 2*time.Minute) } +type OptInAction struct { + Chain ChainID + Validator ValidatorID +} + +func (tr Chain) optIn(action OptInAction, target ExecutionTarget, verbose bool) { + // Note: to get error response reported back from this command '--gas auto' needs to be set. + gas := "auto" + // Unfortunately, --gas auto does not work with CometMock. so when using CometMock, just use --gas 9000000 then + if tr.testConfig.useCometmock { + gas = "9000000" + } + + // Use: "opt-in [consumer-chain-id] [consumer-pubkey]", + optIn := fmt.Sprintf( + `%s tx provider opt-in %s --from validator%s --chain-id %s --home %s --node %s --gas %s --keyring-backend test -y -o json`, + tr.testConfig.chainConfigs[ChainID("provi")].BinaryName, + string(tr.testConfig.chainConfigs[action.Chain].ChainId), + action.Validator, + tr.testConfig.chainConfigs[ChainID("provi")].ChainId, + tr.getValidatorHome(ChainID("provi"), action.Validator), + tr.getValidatorNode(ChainID("provi"), action.Validator), + gas, + ) + + cmd := target.ExecCommand( + "/bin/bash", "-c", + optIn, + ) + + if verbose { + fmt.Println("optIn cmd:", cmd.String()) + } + + bz, err := cmd.CombinedOutput() + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + if !tr.testConfig.useCometmock { // error report only works with --gas auto, which does not work with CometMock, so ignore + if err != nil && verbose { + fmt.Printf("got error during opt in | err: %s | output: %s \n", err, string(bz)) + } + } + + // wait for inclusion in a block -> '--broadcast-mode block' is deprecated + tr.waitBlocks(ChainID("provi"), 2, 30*time.Second) +} + +type OptOutAction struct { + Chain ChainID + Validator ValidatorID + ExpectError bool +} + +func (tr Chain) optOut(action OptOutAction, target ExecutionTarget, verbose bool) { + // Note: to get error response reported back from this command '--gas auto' needs to be set. + gas := "auto" + // Unfortunately, --gas auto does not work with CometMock. so when using CometMock, just use --gas 9000000 then + if tr.testConfig.useCometmock { + gas = "9000000" + } + + // Use: "opt-out [consumer-chain-id]", + optIn := fmt.Sprintf( + `%s tx provider opt-out %s --from validator%s --chain-id %s --home %s --node %s --gas %s --keyring-backend test -y -o json`, + tr.testConfig.chainConfigs[ChainID("provi")].BinaryName, + string(tr.testConfig.chainConfigs[action.Chain].ChainId), + action.Validator, + tr.testConfig.chainConfigs[ChainID("provi")].ChainId, + tr.getValidatorHome(ChainID("provi"), action.Validator), + tr.getValidatorNode(ChainID("provi"), action.Validator), + gas, + ) + + cmd := target.ExecCommand( + "/bin/bash", "-c", + optIn, + ) + + if verbose { + fmt.Println("optOut cmd:", cmd.String()) + } + + bz, err := cmd.CombinedOutput() + if action.ExpectError { + if err != nil { + if verbose { + fmt.Printf("got expected error during opt out | err: %s | output: %s \n", err, string(bz)) + } + } else { + log.Fatal("expected error during opt-out but got none") + } + } else { + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + } + + // wait for inclusion in a block -> '--broadcast-mode block' is deprecated + tr.waitBlocks(ChainID("provi"), 2, 30*time.Second) +} + // WaitTime waits for the given duration. // To make sure that the new timestamp is visible on-chain, it also waits until at least one block has been // produced on each chain after waiting. diff --git a/tests/e2e/builder.go b/tests/e2e/builder.go index 26eb5c34f6..e9e0f00d5a 100644 --- a/tests/e2e/builder.go +++ b/tests/e2e/builder.go @@ -82,7 +82,6 @@ func generateImageName(version string, cfg TargetConfig) (string, error) { tagName = "local" // this refers to build from local workspace } else { // use git hash of rev as docker image tag - // cmd := exec.Command("git", "rev-parse", "--verify", "--short", version) cmd := exec.Command("git", "log", "--pretty=format:%h", "-n", "1", version) out, err := cmd.CombinedOutput() if err != nil { diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 24b3f1ec78..e7493a20f8 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -156,6 +156,42 @@ var stepChoices = map[string]StepChoice{ description: `Minimal set of test steps to perform compatibility tests`, testConfig: CompatibilityTestCfg, }, + "partial-set-security-opt-in": { + name: "partial-set-security-opt-in", + steps: stepsOptInChain(), + description: "test partial set security for an Opt-In chain", + testConfig: DefaultTestCfg, + }, + "partial-set-security-top-n": { + name: "partial-set-security-top-n", + steps: stepsTopNChain(), + description: "test partial set security for a Top-N chain", + testConfig: DefaultTestCfg, + }, + "partial-set-security-validator-set-cap": { + name: "partial-set-security-validator-set-cap", + steps: stepsValidatorSetCappedChain(), + description: "test partial set security for an Opt-In chain that is validator-set capped", + testConfig: DefaultTestCfg, + }, + "partial-set-security-validators-power-cap": { + name: "partial-set-security-validators-power-cap", + steps: stepsValidatorsPowerCappedChain(), + description: "test partial set security for an Opt-In chain that has its validators' power capped", + testConfig: DefaultTestCfg, + }, + "partial-set-security-validators-allowlisted": { + name: "partial-set-security-validators-allowlisted", + steps: stepsValidatorsAllowlistedChain(), + description: "test partial set security for an Opt-In chain that has some validators allowlisted", + testConfig: DefaultTestCfg, + }, + "partial-set-security-validators-denylisted": { + name: "partial-set-security-validators-denylisted", + steps: stepsValidatorsDenylistedChain(), + description: "test partial set security for an Opt-In chain that has a validator denylisted", + testConfig: DefaultTestCfg, + }, } func getTestCaseUsageString() string { @@ -241,7 +277,9 @@ func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet, providerVe "changeover", "happy-path", "democracy-reward", "democracy", "slash-throttle", "consumer-double-sign", "consumer-misbehaviour", - "consumer-double-downtime", + "consumer-double-downtime", "partial-set-security-opt-in", "partial-set-security-top-n", + "partial-set-security-validator-set-cap", "partial-set-security-validators-power-cap", + "partial-set-security-validators-allowlisted", "partial-set-security-validators-denylisted", } if includeMultiConsumer != nil && *includeMultiConsumer { selectedPredefinedTests = append(selectedPredefinedTests, "multiconsumer") diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 86882ddc56..6498d09203 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -108,6 +108,14 @@ func (tr Chain) GetChainState(chain ChainID, modelState ChainState) ChainState { chainState.ClientsFrozenHeights = &chainClientsFrozenHeights } + if modelState.HasToValidate != nil { + hasToValidate := map[ValidatorID][]ChainID{} + for validatorId := range *modelState.HasToValidate { + hasToValidate[validatorId] = tr.target.GetHasToValidate(validatorId) + } + chainState.HasToValidate = &hasToValidate + } + if modelState.ConsumerPendingPacketQueueSize != nil { pendingPacketQueueSize := tr.target.GetPendingPacketQueueSize(chain) chainState.ConsumerPendingPacketQueueSize = &pendingPacketQueueSize @@ -807,6 +815,29 @@ func (tr Commands) GetClientFrozenHeight(chain ChainID, clientID string) (uint64 return uint64(revHeight), uint64(revNumber) } +func (tr Commands) GetHasToValidate( + validatorId ValidatorID, +) []ChainID { + binaryName := tr.chainConfigs[ChainID("provi")].BinaryName + bz, err := tr.target.ExecCommand(binaryName, + "query", "provider", "has-to-validate", + tr.validatorConfigs[validatorId].ValconsAddress, + `--node`, tr.GetQueryNode(ChainID("provi")), + `-o`, `json`, + ).CombinedOutput() + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + arr := gjson.Get(string(bz), "consumer_chain_ids").Array() + chains := []ChainID{} + for _, c := range arr { + chains = append(chains, ChainID(c.String())) + } + + return chains +} + func (tr Commands) GetTrustedHeight( chain ChainID, clientID string, diff --git a/tests/e2e/steps_compatibility.go b/tests/e2e/steps_compatibility.go index 3eaf1eae9c..a51a34fed3 100644 --- a/tests/e2e/steps_compatibility.go +++ b/tests/e2e/steps_compatibility.go @@ -44,6 +44,7 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex ConsumerChain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 100, }, State: State{ ChainID("provi"): ChainState{ @@ -88,18 +89,6 @@ func compstepsStartConsumerChain(consumerName string, proposalIndex, chainIndex }, }, }, - { - // op should fail - key already assigned by the same validator - Action: AssignConsumerPubKeyAction{ - Chain: ChainID(consumerName), - Validator: ValidatorID("carol"), - ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, - ReconfigureNode: false, - ExpectError: true, - ExpectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", - }, - State: State{}, - }, { // op should fail - key already assigned by another validator Action: AssignConsumerPubKeyAction{ diff --git a/tests/e2e/steps_consumer_misbehaviour.go b/tests/e2e/steps_consumer_misbehaviour.go index 8eb7a72973..3808d4388e 100644 --- a/tests/e2e/steps_consumer_misbehaviour.go +++ b/tests/e2e/steps_consumer_misbehaviour.go @@ -39,6 +39,7 @@ func stepsStartChainsWithSoftOptOut(consumerName string) []Step { ConsumerChain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 100, }, State: State{ ChainID("provi"): ChainState{ diff --git a/tests/e2e/steps_partial_set_security.go b/tests/e2e/steps_partial_set_security.go new file mode 100644 index 0000000000..532cfdfc9a --- /dev/null +++ b/tests/e2e/steps_partial_set_security.go @@ -0,0 +1,1894 @@ +package main + +import clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + +// stepsOptInChain starts a provider chain and an Opt-In chain and opts in and out validators +func stepsOptInChain() []Step { + s := []Step{ + { + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: SubmitConsumerAdditionProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + // Οpt in "alice" and "bob" so the chain is not empty when it is about to start. Note, that "alice" and "bob" use + // the provider's public key (see `UseConsumerKey` is set to `false` in `getDefaultValidators`) and hence do not + // need a consumer-key assignment. + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // chain is not running yet + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: VoteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "yes"}, + PropNumber: 1, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + }, + }, + }, + { + // we start all the validators but only "alice" and "bob" have opted in and hence + // only "alice" and "bob" are validating blocks + Action: StartConsumerChainAction{ + ConsumerChain: ChainID("consu"), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + // For consumers that're launching with the provider being on an earlier version + // of ICS before the soft opt-out threshold was introduced, we need to set the + // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the + // consumer binary doesn't panic. Sdk requires that all params are set to valid + // values from the genesis file. + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + // carol has not yet opted in + ValidatorID("carol"): 0, + }, + }, + }, + }, + { + Action: AddIbcConnectionAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: 0, + }, + State: State{}, + }, + { + Action: AddIbcChannelAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + // "carol" has opted in, but the VSCPacket capturing the opt-in was not relayed yet + ValidatorID("carol"): 0, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + // assign the consumer key "carol" is using on the consumer chain to be the one "carol" uses when opting in + Action: AssignConsumerPubKeyAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + // reconfigure the node -> validator was using provider key + // until this point -> key matches config.consumerValPubKey for "carol" + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, + ReconfigureNode: true, + }, + State: State{}, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + // carol has now opted in + ValidatorID("carol"): 300, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + Action: OptOutAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + // "bob" has not yet opted out from the consumer chain because the VSCPacket has not yet been relayed + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + // bob has now opted out + ValidatorID("bob"): 0, + ValidatorID("carol"): 300, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + // re opt-in "bob" + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + // "bob" has not yet been opted in to the consumer chain because the VSCPacket has not yet been relayed + ValidatorID("bob"): 0, + ValidatorID("carol"): 300, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, // but has to validate is true because bob opted in on the provider + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + // bob is in power on the consumer + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + // DowntimeSlash for alice on consumer + Action: DowntimeSlashAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + // powers are not affected yet on either chain + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + // relay the slash packet + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + // alice's power is reduced on the provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // alice is jailed on the provider and does not have to validate + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + // relay the VSCPacket that contains the slashed power for alice + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + // alice's power is reduced on the provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // alice is jailed on the provider and does not have to validate + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // alice should definitely not be in power on the consumer + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + // unjail alice + Action: UnjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("alice"), + }, + // alices power is restored on the provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, // alice is unjailed and hence has to validate again + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + // still 0 power on the consumer + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + // relay the VSCPacket that puts alice back into power on the consumer + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + // alice's power is restored on the consumer + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + // slash alice for downtime again + Action: DowntimeSlashAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + // alice's power is not yet reduced, the packet needs to be relayed + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + // relay the slash packet + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + // alice's power is reduced on the provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // alice is jailed on the provider and does not have to validate + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + // relay the VSCPacket that contains the slashed power for alice + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + // alice's power is reduced on the consumer + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // alice is jailed on the provider and does not have to validate + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + } + + return s +} + +// stepsTopNChain starts a provider chain and a Top-N chain and opts in and out validators +func stepsTopNChain() []Step { + s := []Step{ + { + // start a new chain where "alice", "bob", and "carol" have 20%, 30%, and 50% of + // the total voting power respectively + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 300000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 500000000, Allocation: 10000000000}, + }, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + // propose a Top-N chain with N = 51% and hence both "carol" and "bob" have to validate + Action: SubmitConsumerAdditionProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 51, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + }, + }, + }, + { + // change the consumer key "carol" is using on the consumer chain to be the one "carol" uses when opting in + Action: AssignConsumerPubKeyAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + // reconfigure the node -> validator was using provider key + // until this point -> key matches config.consumerValPubKey for "bob" + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, + ReconfigureNode: true, + }, + State: State{}, + }, + { + Action: VoteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "yes"}, + PropNumber: 1, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + }, + }, + }, + { + // we start all the validators but only "alice" and "bob" have opted in and hence + // only "alice" and "bob" are validating blocks + Action: StartConsumerChainAction{ + ConsumerChain: ChainID("consu"), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 300000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 500000000, Allocation: 10000000000}, + }, + // For consumers that're launching with the provider being on an earlier version + // of ICS before the soft opt-out threshold was introduced, we need to set the + // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the + // consumer binary doesn't panic. Sdk requires that all params are set to valid + // values from the genesis file. + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + Action: AddIbcConnectionAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: 0, + }, + State: State{}, + }, + { + Action: AddIbcChannelAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // "alice" is not yet opted in because the VSCPacket has not yet been relayed + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // "alice" is now opted in + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + Action: OptOutAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + ExpectError: true, + }, + State: State{}, + }, + { + Action: OptOutAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + ExpectError: true, + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + // opting out "bob" or "carol" does not work because they belong to the Top N validators + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + Action: OptOutAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{}, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // "alice" has now opted out + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // alice has opted out and the epoch is over, so definitely does not have to validate anymore + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + // opt alice back in + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, // alice has to validate again + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // "alice" has now opted in + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + { + // DowntimeSlash for alice on consumer + Action: DowntimeSlashAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + // powers are not affected yet on either chain + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + // relay the slash packet + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + // alice's power is reduced on the provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + // relay the VSCPacket that contains the slashed power for alice + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + // alice's power is reduced on the provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // alice should definitely not be in power on the consumer + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + // unjail alice + Action: UnjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("alice"), + }, + // alices power is restored on the provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + // still 0 power on the consumer + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + // relay the VSCPacket that puts alice back into power on the consumer + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + // alice's power is restored on the consumer + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + // slash alice for downtime again + Action: DowntimeSlashAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + // alice's power is not yet reduced, the packet needs to be relayed + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 200, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + // relay the slash packet + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + // alice's power is reduced on the provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + { + // relay the VSCPacket that contains the slashed power for alice + Action: RelayPacketsAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + Port: "consumer", + Channel: 0, + }, + // alice's power is reduced on the consumer + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 300, + ValidatorID("carol"): 500, + }, + }, + }, + }, + } + + return s +} + +// stepsValidatorSetCappedChain starts a provider chain and an Opt-In chain that is validator-set capped +func stepsValidatorSetCappedChain() []Step { + s := []Step{ + { + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: SubmitConsumerAdditionProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + // we can have at most 2 validators validating the consumer chain + ValidatorSetCap: 2, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + // Οpt in "alice", "bob", and "carol." Note, that "alice" and "bob" use the provider's public key + // (see `UseConsumerKey` is set to `false` in `getDefaultValidators`) and hence do not need a consumer-key assignment. + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + // chain is not running yet and hence no one has to validate + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + // assign the consumer key "carol" is using on the consumer chain to be the one "carol" uses when opting in + Action: AssignConsumerPubKeyAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + // reconfigure the node -> validator was using provider key + // until this point -> key matches config.consumerValPubKey for "carol" + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, + ReconfigureNode: true, + }, + State: State{}, + }, + { + Action: VoteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "yes"}, + PropNumber: 1, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + }, + }, + }, + { + Action: StartConsumerChainAction{ + ConsumerChain: ChainID("consu"), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + // For consumers that're launching with the provider being on an earlier version + // of ICS before the soft opt-out threshold was introduced, we need to set the + // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the + // consumer binary doesn't panic. Sdk requires that all params are set to valid + // values from the genesis file. + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // alice does not validate because the consumer chain is validator-set capped to 2 validators and + // bob and carol have more power than alice + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: AddIbcConnectionAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: 0, + }, + State: State{}, + }, + { + Action: AddIbcChannelAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + { + Action: OptOutAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 200, + // "carol" has opted out, but the VSCPacket capturing the opt-out was not relayed yet + ValidatorID("carol"): 300, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {}, // "carol" does not have to validate anymore because it opted out + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // "alice" is now validating the consumer chain as well because the chain is capped to 2 validators + // and "carol" just opted out + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + // "carol" has now opted out + ValidatorID("carol"): 0, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + } + + return s +} + +// stepsValidatorsPowerCappedChain starts a provider chain and an Opt-In chain that is validators-power capped +func stepsValidatorsPowerCappedChain() []Step { + s := []Step{ + { + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: SubmitConsumerAdditionProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + // Set the power cap to 34%. No validator can have more than 34% of the voting power on the consumer chain + ValidatorsPowerCap: 34, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + // Οpt in "alice", "bob", and "carol." Note, that "alice" and "bob" use the provider's public key + // (see `UseConsumerKey` is set to `false` in `getDefaultValidators`) and hence do not need a consumer-key assignment. + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // chain is not running yet + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + // assign the consumer key "carol" is using on the consumer chain to be the one "carol" uses when opting in + Action: AssignConsumerPubKeyAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + // reconfigure the node -> validator was using provider key + // until this point -> key matches config.consumerValPubKey for "carol" + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, + ReconfigureNode: true, + }, + State: State{}, + }, + { + Action: VoteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "yes"}, + PropNumber: 1, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + }, + }, + }, + { + Action: StartConsumerChainAction{ + ConsumerChain: ChainID("consu"), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + // For consumers that're launching with the provider being on an earlier version + // of ICS before the soft opt-out threshold was introduced, we need to set the + // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the + // consumer binary doesn't panic. Sdk requires that all params are set to valid + // values from the genesis file. + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // the powers of the validators on the consumer chain are different from the provider chain + // because the consumer chain is power capped. Note that the total power is 600 (= 192 + 204 + 204) + // and 204 / 600.0 = 0.34 <= 34% that is the power cap. + ValidatorID("alice"): 192, + ValidatorID("bob"): 204, + ValidatorID("carol"): 204, + }, + }, + }, + }, + { + Action: AddIbcConnectionAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: 0, + }, + State: State{}, + }, + { + Action: AddIbcChannelAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + { + Action: OptOutAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 192, + ValidatorID("bob"): 204, + ValidatorID("carol"): 204, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {}, // "carol" does not have to validate anymore because it opted out + }, + }, + }, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + // "carol" has opted out, and we only have 2 validators left validating. Power capping only operates + // in a best-effort basis and with 2 validators we cannot guarantee that no validator has more + // than 34% of the voting power. In this case, both validators get the same voting power (50% = 102 / 204). + ValidatorID("alice"): 102, + ValidatorID("bob"): 102, + ValidatorID("carol"): 0, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + } + + return s +} + +// stepsValidatorsAllowlistedChain starts a provider chain and an Opt-In chain with an allowlist +func stepsValidatorsAllowlistedChain() []Step { + s := []Step{ + { + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: SubmitConsumerAdditionProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + // only "alice" and "bob" are allowlisted (see `getDefaultValidators` in `tests/e2e/config.go`) + Allowlist: []string{"cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39"}, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + // Οpt in "alice", "bob", and "carol." Note, that "alice" and "bob" use the provider's public key + // (see `UseConsumerKey` is set to `false` in `getDefaultValidators`) and hence do not need a consumer-key assignment. + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // chain is not running yet + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + // assign the consumer key "carol" is using on the consumer chain to be the one "carol" uses when opting in + Action: AssignConsumerPubKeyAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + // reconfigure the node -> validator was using provider key + // until this point -> key matches config.consumerValPubKey for "carol" + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, + ReconfigureNode: true, + }, + State: State{}, + }, + { + Action: VoteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "yes"}, + PropNumber: 1, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + }, + }, + }, + { + Action: StartConsumerChainAction{ + ConsumerChain: ChainID("consu"), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + // For consumers that're launching with the provider being on an earlier version + // of ICS before the soft opt-out threshold was introduced, we need to set the + // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the + // consumer binary doesn't panic. Sdk requires that all params are set to valid + // values from the genesis file. + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + // "carol" is not allowlisted and hence does not validate the consumer chain + ValidatorID("carol"): 0, + }, + }, + }, + }, + { + Action: AddIbcConnectionAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: 0, + }, + State: State{}, + }, + { + Action: AddIbcChannelAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 0, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {"consu"}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + } + + return s +} + +// stepsValidatorsDenylistedChain starts a provider chain and an Opt-In chain with a denylist +func stepsValidatorsDenylistedChain() []Step { + s := []Step{ + { + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 200, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: SubmitConsumerAdditionProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + // only "bob" is denylisted (see `getDefaultValidators` in `tests/e2e/config.go`) + Denylist: []string{"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39"}, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + // Οpt in "alice", "bob", and "carol." Note, that "alice" and "bob" use the provider's public key + // (see `UseConsumerKey` is set to `false` in `getDefaultValidators`) and hence do not need a consumer-key assignment. + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("alice"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, // chain is not running yet + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + Action: OptInAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + }, + State: State{ + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {}, + }, + }, + }, + }, + { + // assign the consumer key "carol" is using on the consumer chain to be the one "carol" uses when opting in + Action: AssignConsumerPubKeyAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("carol"), + // reconfigure the node -> validator was using provider key + // until this point -> key matches config.consumerValPubKey for "carol" + ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, + ReconfigureNode: true, + }, + State: State{}, + }, + { + Action: VoteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "yes"}, + PropNumber: 1, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + }, + }, + }, + { + Action: StartConsumerChainAction{ + ConsumerChain: ChainID("consu"), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 100000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 200000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 300000000, Allocation: 10000000000}, + }, + // For consumers that're launching with the provider being on an earlier version + // of ICS before the soft opt-out threshold was introduced, we need to set the + // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the + // consumer binary doesn't panic. Sdk requires that all params are set to valid + // values from the genesis file. + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + // "bob" is denylisted and hence does not valiate the consumer chain + ValidatorID("bob"): 0, + ValidatorID("carol"): 300, + }, + }, + }, + }, + { + Action: AddIbcConnectionAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: 0, + }, + State: State{}, + }, + { + Action: AddIbcChannelAction{ + ChainA: ChainID("consu"), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + { + Action: RelayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID("consu"), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100, + ValidatorID("bob"): 0, + ValidatorID("carol"): 300, + }, + }, + ChainID("provi"): ChainState{ + HasToValidate: &map[ValidatorID][]ChainID{ + ValidatorID("alice"): {"consu"}, + ValidatorID("bob"): {}, + ValidatorID("carol"): {"consu"}, + }, + }, + }, + }, + } + + return s +} diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go index e3c6563204..68ed5c8505 100644 --- a/tests/e2e/steps_sovereign_changeover.go +++ b/tests/e2e/steps_sovereign_changeover.go @@ -53,6 +53,7 @@ func stepsChangeoverToConsumer(consumerName string) []Step { DistributionChannel: "channel-0", SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, // 1 block after upgrade !important + TopN: 100, }, State: State{ ChainID("provi"): ChainState{ diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index 5e25981691..e358862590 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -41,6 +41,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint ConsumerChain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 100, }, State: State{ ChainID("provi"): ChainState{ @@ -85,16 +86,24 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint }, }, { - // op should fail - key already assigned by the same validator + // op should be a noop - key already assigned, but by the same validator Action: AssignConsumerPubKeyAction{ Chain: ChainID(consumerName), Validator: ValidatorID("carol"), ConsumerPubkey: getDefaultValidators()[ValidatorID("carol")].ConsumerValPubKey, ReconfigureNode: false, - ExpectError: true, - ExpectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", + ExpectError: false, + }, + State: State{ + ChainID(consumerName): ChainState{ + AssignedKeys: &map[ValidatorID]string{ + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ConsumerValconsAddressOnProvider, + }, + ProviderKeys: &map[ValidatorID]string{ + ValidatorID("carol"): getDefaultValidators()[ValidatorID("carol")].ValconsAddress, + }, + }, }, - State: State{}, }, { // op should fail - key already assigned by another validator diff --git a/tests/e2e/test_driver.go b/tests/e2e/test_driver.go index a4c2424ff5..17a8976377 100644 --- a/tests/e2e/test_driver.go +++ b/tests/e2e/test_driver.go @@ -201,6 +201,10 @@ func (td *DefaultDriver) runAction(action interface{}) error { target.startConsumerEvidenceDetector(action, td.verbose) case SubmitChangeRewardDenomsProposalAction: target.submitChangeRewardDenomsProposal(action, td.verbose) + case OptInAction: + target.optIn(action, td.target, td.verbose) + case OptOutAction: + target.optOut(action, td.target, td.verbose) default: log.Fatalf("unknown action in testRun %s: %#v", td.testCfg.name, action) } diff --git a/tests/e2e/testlib/types.go b/tests/e2e/testlib/types.go index dd600bb624..eac5d5b632 100644 --- a/tests/e2e/testlib/types.go +++ b/tests/e2e/testlib/types.go @@ -21,6 +21,7 @@ type ChainCommands interface { GetConsumerChains(chain ChainID) map[ChainID]bool GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string GetClientFrozenHeight(chain ChainID, clientID string) (RevisionNumber, RevisionHeight uint64) + GetHasToValidate(validator ValidatorID) []ChainID GetIBCTransferParams(chain ChainID) IBCTransferParams GetProposal(chain ChainID, proposal uint) Proposal GetParam(chain ChainID, param Param) string @@ -168,6 +169,7 @@ type ChainState struct { ConsumerPendingPacketQueueSize *uint // Only relevant to consumer chains RegisteredConsumerRewardDenoms *[]string ClientsFrozenHeights *map[string]clienttypes.Height + HasToValidate *map[ValidatorID][]ChainID // only relevant to provider chain } // custom marshal and unmarshal functions for the chainstate that convert proposals to/from the auxiliary type with type info diff --git a/tests/e2e/tracehandler_testdata/changeover.json b/tests/e2e/tracehandler_testdata/changeover.json index b7f3de992e..b115680878 100644 --- a/tests/e2e/tracehandler_testdata/changeover.json +++ b/tests/e2e/tracehandler_testdata/changeover.json @@ -28,6 +28,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -58,6 +59,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -104,6 +106,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -151,6 +154,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -193,6 +197,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -229,7 +234,8 @@ "InitialHeight": { "revision_height": 111 }, - "DistributionChannel": "channel-0" + "DistributionChannel": "channel-0", + "TopN": 100 }, "State": { "provi": { @@ -248,6 +254,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -298,6 +305,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -357,6 +365,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "sover": { @@ -376,6 +385,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -427,6 +437,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -457,6 +468,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "sover": { @@ -476,6 +488,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -506,6 +519,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -534,6 +548,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -564,6 +579,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "sover": { @@ -583,6 +599,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -613,6 +630,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/consumer-double-sign.json b/tests/e2e/tracehandler_testdata/consumer-double-sign.json index cf113f3db9..7744bc5b03 100644 --- a/tests/e2e/tracehandler_testdata/consumer-double-sign.json +++ b/tests/e2e/tracehandler_testdata/consumer-double-sign.json @@ -41,6 +41,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -57,7 +58,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -78,6 +80,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -123,6 +126,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -134,10 +138,31 @@ "Validator": "carol", "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", "ReconfigureNode": false, - "ExpectError": true, - "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + "ExpectError": false, + "ExpectedError": "" }, - "State": {} + "State": { + "consu": { + "ValBalances": null, + "ProposedConsumerChains": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "HasToValidate": null, + "Proposals": null + } + } }, { "ActionType": "main.AssignConsumerPubKeyAction", @@ -168,6 +193,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -205,6 +231,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -264,6 +291,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -283,6 +311,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -334,6 +363,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -357,6 +387,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -384,6 +415,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -407,6 +439,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -437,6 +470,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -460,6 +494,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json b/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json index d2df468fb3..90f009fb7e 100644 --- a/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json +++ b/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json @@ -35,6 +35,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -51,7 +52,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -70,6 +72,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -115,6 +118,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -150,6 +154,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -197,6 +202,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -215,6 +221,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -267,6 +274,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -285,6 +293,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -314,6 +323,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -355,6 +365,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -376,6 +387,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -405,6 +417,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -430,6 +443,7 @@ "revision_height": 1 } }, + "HasToValidate": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/democracy.json b/tests/e2e/tracehandler_testdata/democracy.json index 72b2b6c508..633e13ee08 100644 --- a/tests/e2e/tracehandler_testdata/democracy.json +++ b/tests/e2e/tracehandler_testdata/democracy.json @@ -41,6 +41,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -57,7 +58,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -78,6 +80,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -123,6 +126,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -134,10 +138,31 @@ "Validator": "carol", "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", "ReconfigureNode": false, - "ExpectError": true, - "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + "ExpectError": false, + "ExpectedError": "" }, - "State": {} + "State": { + "democ": { + "ValBalances": null, + "ProposedConsumerChains": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "HasToValidate": null, + "Proposals": null + } + } }, { "ActionType": "main.AssignConsumerPubKeyAction", @@ -168,6 +193,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -205,6 +231,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -264,6 +291,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -283,6 +311,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -350,6 +379,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -369,6 +399,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -398,6 +429,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -428,6 +460,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -457,6 +490,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -503,6 +537,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -544,6 +579,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -573,6 +609,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -621,6 +658,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -668,6 +706,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": [], "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -693,6 +732,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": [], "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -729,6 +769,7 @@ "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9" ], "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -763,6 +804,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -791,6 +833,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -810,6 +853,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -840,6 +884,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -859,6 +904,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -889,6 +935,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -917,6 +964,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -936,6 +984,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -969,6 +1018,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json index 4a37cd6d0c..75487915de 100644 --- a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json +++ b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json @@ -41,6 +41,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -57,7 +58,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -78,6 +80,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -123,6 +126,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -134,10 +138,31 @@ "Validator": "carol", "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", "ReconfigureNode": false, - "ExpectError": true, - "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + "ExpectError": false, + "ExpectedError": "" }, - "State": {} + "State": { + "democ": { + "ValBalances": null, + "ProposedConsumerChains": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "HasToValidate": null, + "Proposals": null + } + } }, { "ActionType": "main.AssignConsumerPubKeyAction", @@ -168,6 +193,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -205,6 +231,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -264,6 +291,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -283,6 +311,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -350,6 +379,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -369,6 +399,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -398,6 +429,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -428,6 +460,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -457,6 +490,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -503,6 +537,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -544,6 +579,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -573,6 +609,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -621,6 +658,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -668,6 +706,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": [], "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -693,6 +732,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": [], "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -729,6 +769,7 @@ "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9" ], "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -763,6 +804,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -791,6 +833,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -810,6 +853,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -840,6 +884,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -859,6 +904,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -889,6 +935,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -917,6 +964,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -936,6 +984,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -969,6 +1018,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/happyPath.json b/tests/e2e/tracehandler_testdata/happyPath.json index aba049cb5d..e5f732eaf0 100644 --- a/tests/e2e/tracehandler_testdata/happyPath.json +++ b/tests/e2e/tracehandler_testdata/happyPath.json @@ -41,6 +41,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -57,7 +58,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -78,6 +80,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -123,6 +126,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -134,10 +138,31 @@ "Validator": "carol", "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", "ReconfigureNode": false, - "ExpectError": true, - "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + "ExpectError": false, + "ExpectedError": "" }, - "State": {} + "State": { + "consu": { + "ValBalances": null, + "ProposedConsumerChains": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "HasToValidate": null, + "Proposals": null + } + } }, { "ActionType": "main.AssignConsumerPubKeyAction", @@ -168,6 +193,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -205,6 +231,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -264,6 +291,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -283,6 +311,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -336,6 +365,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -355,6 +385,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -384,6 +415,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -414,6 +446,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -443,6 +476,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -481,6 +515,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -500,6 +535,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -536,6 +572,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -555,6 +592,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -585,6 +623,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -604,6 +643,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -634,6 +674,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -664,6 +705,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -683,6 +725,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -713,6 +756,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -743,6 +787,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -762,6 +807,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -792,6 +838,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -823,6 +870,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -842,6 +890,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -872,6 +921,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -900,6 +950,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -919,6 +970,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -949,6 +1001,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -968,6 +1021,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -999,6 +1053,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1018,6 +1073,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1048,6 +1104,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1076,6 +1133,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1095,6 +1153,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1124,6 +1183,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1143,6 +1203,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1173,6 +1234,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1201,6 +1263,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1220,6 +1283,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1250,6 +1314,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1278,6 +1343,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1297,6 +1363,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1327,6 +1394,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1355,6 +1423,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1374,6 +1443,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1404,6 +1474,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1432,6 +1503,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1451,6 +1523,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1481,6 +1554,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1500,6 +1574,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1536,6 +1611,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "2": { "RawProposal": { @@ -1584,6 +1660,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "2": { "RawProposal": { @@ -1625,6 +1702,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "3": { "RawProposal": { @@ -1671,6 +1749,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "3": { "RawProposal": { diff --git a/tests/e2e/tracehandler_testdata/multipleConsumers.json b/tests/e2e/tracehandler_testdata/multipleConsumers.json index ac6c6b6b96..504e742a60 100644 --- a/tests/e2e/tracehandler_testdata/multipleConsumers.json +++ b/tests/e2e/tracehandler_testdata/multipleConsumers.json @@ -41,6 +41,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -57,7 +58,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -78,6 +80,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -123,6 +126,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -134,10 +138,31 @@ "Validator": "carol", "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", "ReconfigureNode": false, - "ExpectError": true, - "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + "ExpectError": false, + "ExpectedError": "" }, - "State": {} + "State": { + "consu": { + "ValBalances": null, + "ProposedConsumerChains": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "HasToValidate": null, + "Proposals": null + } + } }, { "ActionType": "main.AssignConsumerPubKeyAction", @@ -168,6 +193,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -205,6 +231,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -264,6 +291,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -283,6 +311,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -322,7 +351,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -343,6 +373,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "2": { "RawProposal": { @@ -388,6 +419,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -399,10 +431,31 @@ "Validator": "carol", "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", "ReconfigureNode": false, - "ExpectError": true, - "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + "ExpectError": false, + "ExpectedError": "" }, - "State": {} + "State": { + "densu": { + "ValBalances": null, + "ProposedConsumerChains": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "HasToValidate": null, + "Proposals": null + } + } }, { "ActionType": "main.AssignConsumerPubKeyAction", @@ -433,6 +486,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -470,6 +524,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "2": { "RawProposal": { @@ -529,6 +584,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -548,6 +604,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -601,6 +658,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -620,6 +678,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -639,6 +698,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -669,6 +729,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -688,6 +749,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -707,6 +769,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -737,6 +800,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -756,6 +820,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -775,6 +840,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -805,6 +871,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -824,6 +891,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -843,6 +911,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -873,6 +942,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -892,6 +962,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -911,6 +982,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -941,6 +1013,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -960,6 +1033,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -979,6 +1053,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1010,6 +1085,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1029,6 +1105,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1048,6 +1125,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1078,6 +1156,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1097,6 +1176,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1116,6 +1196,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1146,6 +1227,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1165,6 +1247,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1184,6 +1267,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1212,6 +1296,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1231,6 +1316,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1250,6 +1336,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1280,6 +1367,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1299,6 +1387,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1318,6 +1407,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1348,6 +1438,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1367,6 +1458,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1397,6 +1489,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1416,6 +1509,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1444,6 +1538,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1463,6 +1558,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1482,6 +1578,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1512,6 +1609,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1531,6 +1629,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1550,6 +1649,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1580,6 +1680,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1599,6 +1700,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1618,6 +1720,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1646,6 +1749,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1665,6 +1769,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1684,6 +1789,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1714,6 +1820,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1733,6 +1840,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1752,6 +1860,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1782,6 +1891,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1801,6 +1911,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1820,6 +1931,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1848,6 +1960,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1867,6 +1980,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1886,6 +2000,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1916,6 +2031,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -1935,6 +2051,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1954,6 +2071,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1984,6 +2102,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -2003,6 +2122,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -2022,6 +2142,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -2050,6 +2171,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -2069,6 +2191,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -2088,6 +2211,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -2118,6 +2242,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -2137,6 +2262,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -2156,6 +2282,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -2186,6 +2313,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -2205,6 +2333,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -2224,6 +2353,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -2252,6 +2382,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -2271,6 +2402,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -2290,6 +2422,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -2320,6 +2453,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -2339,6 +2473,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -2358,6 +2493,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -2388,6 +2524,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -2407,6 +2544,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -2426,6 +2564,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -2456,6 +2595,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "densu": { @@ -2475,6 +2615,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/shorthappy.json b/tests/e2e/tracehandler_testdata/shorthappy.json index 490d67e5c5..60c645e8c9 100644 --- a/tests/e2e/tracehandler_testdata/shorthappy.json +++ b/tests/e2e/tracehandler_testdata/shorthappy.json @@ -41,6 +41,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -57,7 +58,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -78,6 +80,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -123,6 +126,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -134,10 +138,31 @@ "Validator": "carol", "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", "ReconfigureNode": false, - "ExpectError": true, - "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + "ExpectError": false, + "ExpectedError": "" }, - "State": {} + "State": { + "consu": { + "ValBalances": null, + "ProposedConsumerChains": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "HasToValidate": null, + "Proposals": null + } + } }, { "ActionType": "main.AssignConsumerPubKeyAction", @@ -168,6 +193,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -205,6 +231,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -264,6 +291,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -283,6 +311,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -336,6 +365,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -355,6 +385,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -384,6 +415,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -414,6 +446,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -443,6 +476,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -473,6 +507,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -492,6 +527,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -522,6 +558,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -553,6 +590,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -572,6 +610,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -602,6 +641,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -630,6 +670,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -649,6 +690,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -678,6 +720,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -697,6 +740,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -727,6 +771,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -755,6 +800,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -774,6 +820,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -804,6 +851,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -832,6 +880,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -851,6 +900,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -881,6 +931,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -909,6 +960,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -928,6 +980,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -958,6 +1011,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -986,6 +1040,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1005,6 +1060,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1035,6 +1091,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -1054,6 +1111,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -1090,6 +1148,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "2": { "RawProposal": { @@ -1138,6 +1197,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "2": { "RawProposal": { @@ -1179,6 +1239,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "3": { "RawProposal": { @@ -1225,6 +1286,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "3": { "RawProposal": { diff --git a/tests/e2e/tracehandler_testdata/slashThrottle.json b/tests/e2e/tracehandler_testdata/slashThrottle.json index 9d35c04d85..e325113cc4 100644 --- a/tests/e2e/tracehandler_testdata/slashThrottle.json +++ b/tests/e2e/tracehandler_testdata/slashThrottle.json @@ -41,6 +41,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -57,7 +58,8 @@ "InitialHeight": { "revision_height": 1 }, - "DistributionChannel": "" + "DistributionChannel": "", + "TopN": 100 }, "State": { "provi": { @@ -78,6 +80,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -123,6 +126,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -134,10 +138,31 @@ "Validator": "carol", "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", "ReconfigureNode": false, - "ExpectError": true, - "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + "ExpectError": false, + "ExpectedError": "" }, - "State": {} + "State": { + "consu": { + "ValBalances": null, + "ProposedConsumerChains": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "HasToValidate": null, + "Proposals": null + } + } }, { "ActionType": "main.AssignConsumerPubKeyAction", @@ -168,6 +193,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -205,6 +231,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "1": { "RawProposal": { @@ -264,6 +291,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -283,6 +311,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -336,6 +365,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -355,6 +385,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -384,6 +415,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -414,6 +446,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -443,6 +476,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -471,6 +505,7 @@ "ConsumerPendingPacketQueueSize": 1, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -490,6 +525,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -520,6 +556,7 @@ "ConsumerPendingPacketQueueSize": 0, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -539,6 +576,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -567,6 +605,7 @@ "ConsumerPendingPacketQueueSize": 1, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -586,6 +625,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -616,6 +656,7 @@ "ConsumerPendingPacketQueueSize": 1, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -635,6 +676,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -663,6 +705,7 @@ "ConsumerPendingPacketQueueSize": 1, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -682,6 +725,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -705,6 +749,7 @@ "ConsumerPendingPacketQueueSize": 1, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -724,6 +769,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -750,6 +796,7 @@ "ConsumerPendingPacketQueueSize": 0, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null }, "provi": { @@ -769,6 +816,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": null } } @@ -800,6 +848,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "2": { "RawProposal": { @@ -846,6 +895,7 @@ "ConsumerPendingPacketQueueSize": null, "RegisteredConsumerRewardDenoms": null, "ClientsFrozenHeights": null, + "HasToValidate": null, "Proposals": { "2": { "RawProposal": { diff --git a/tests/e2e/v4/state.go b/tests/e2e/v4/state.go index 9ee3c7ec97..70ca8afe7c 100644 --- a/tests/e2e/v4/state.go +++ b/tests/e2e/v4/state.go @@ -649,6 +649,10 @@ func (tr Commands) GetIBCTransferParams(chain ChainID) IBCTransferParams { panic("'GetIBCTransferParams' is not implemented in this version") } +func (tr Commands) GetHasToValidate(validator ValidatorID) []ChainID { + panic("''GetHasToValidate' is not implemented in this version") +} + func uintPtr(i uint) *uint { return &i } diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index b54720a5a4..109f604854 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -3,16 +3,19 @@ package integration import ( "strings" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "cosmossdk.io/math" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - sdkdistrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - icstestingutils "github.com/cosmos/interchain-security/v5/testutil/integration" consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" consumertypes "github.com/cosmos/interchain-security/v5/x/ccv/consumer/types" + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) @@ -43,6 +46,8 @@ func (s *CCVTestSuite) TestRewardsDistribution() { providerAccountKeeper := s.providerApp.GetTestAccountKeeper() consumerBankKeeper := s.consumerApp.GetTestBankKeeper() providerBankKeeper := s.providerApp.GetTestBankKeeper() + providerKeeper := s.providerApp.GetProviderKeeper() + providerDistributionKeeper := s.providerApp.GetTestDistributionKeeper() // send coins to the fee pool which is used for reward distribution consumerFeePoolAddr := consumerAccountKeeper.GetModuleAccount(s.consumerCtx(), authtypes.FeeCollectorName).GetAddress() @@ -71,7 +76,6 @@ func (s *CCVTestSuite) TestRewardsDistribution() { s.Require().Equal(providerExpectedRewards.AmountOf(sdk.DefaultBondDenom), providerTokens.AmountOf(sdk.DefaultBondDenom)) // send the reward to provider chain after 2 blocks - s.consumerChain.NextBlock() providerTokens = consumerBankKeeper.GetAllBalances(s.consumerCtx(), providerRedistributeAddr) s.Require().Equal(0, len(providerTokens)) @@ -83,55 +87,85 @@ func (s *CCVTestSuite) TestRewardsDistribution() { rewardPool := providerAccountKeeper.GetModuleAccount(s.providerCtx(), providertypes.ConsumerRewardsPool).GetAddress() rewardCoins := providerBankKeeper.GetAllBalances(s.providerCtx(), rewardPool) - ibcCoinIndex := -1 - - for i, coin := range rewardCoins { + // Check that the reward pool contains a coin with an IBC denom + rewardsIBCdenom := "" + for _, coin := range rewardCoins { if strings.HasPrefix(coin.Denom, "ibc") { - ibcCoinIndex = i + rewardsIBCdenom = coin.Denom } } - - // Check that we found an ibc denom in the reward pool - s.Require().Greater(ibcCoinIndex, -1) - ibcDenom := rewardCoins[ibcCoinIndex].Denom + s.Require().NotZero(rewardsIBCdenom) // Check that the coins got into the ConsumerRewardsPool - s.Require().True(rewardCoins[ibcCoinIndex].Amount.Equal(providerExpectedRewards[0].Amount)) + providerExpRewardsAmount := providerExpectedRewards.AmountOf(sdk.DefaultBondDenom) + s.Require().Equal(rewardCoins.AmountOf(rewardsIBCdenom), providerExpRewardsAmount) // Advance a block and check that the coins are still in the ConsumerRewardsPool s.providerChain.NextBlock() rewardCoins = providerBankKeeper.GetAllBalances(s.providerCtx(), rewardPool) - s.Require().True(rewardCoins[ibcCoinIndex].Amount.Equal(providerExpectedRewards[0].Amount)) - - // Set the consumer reward denom. This would be done by a governance proposal in prod - s.providerApp.GetProviderKeeper().SetConsumerRewardDenom(s.providerCtx(), ibcDenom) + s.Require().Equal(rewardCoins.AmountOf(rewardsIBCdenom), providerExpRewardsAmount) + + // Set the consumer reward denom. This would be done by a governance proposal in prod. + providerKeeper.SetConsumerRewardDenom(s.providerCtx(), rewardsIBCdenom) + + // Refill the consumer fee pool + err = consumerBankKeeper.SendCoinsFromAccountToModule( + s.consumerCtx(), + s.consumerChain.SenderAccount.GetAddress(), + authtypes.FeeCollectorName, + fees, + ) + s.Require().NoError(err) - s.providerChain.NextBlock() + // Pass two blocks + s.consumerChain.NextBlock() + s.consumerChain.NextBlock() - // Check that the reward pool has no more coins because they were transferred to the fee collector + // Save the consumer validators total outstanding rewards on the provider + consumerValsOutstandingRewardsFunc := func(ctx sdk.Context) sdk.DecCoins { + totalRewards := sdk.DecCoins{} + for _, v := range providerKeeper.GetConsumerValSet(ctx, s.consumerChain.ChainID) { + val, err := s.providerApp.GetTestStakingKeeper().GetValidatorByConsAddr(ctx, sdk.ConsAddress(v.ProviderConsAddr)) + s.Require().NoError(err) + valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) + s.Require().NoError(err) + valReward, _ := providerDistributionKeeper.GetValidatorOutstandingRewards(ctx, valAddr) + totalRewards = totalRewards.Add(valReward.Rewards...) + } + return totalRewards + } + consuValsRewards := consumerValsOutstandingRewardsFunc(s.providerCtx()) + + // Transfer rewards from consumer to provider + relayAllCommittedPackets( + s, + s.consumerChain, + s.transferPath, + transfertypes.PortID, + s.transferPath.EndpointA.ChannelID, + 1, + ) + + // Check that the consumer rewards allocation are empty since relayAllCommittedPackets calls BeginBlockRD, + // which in turns calls AllocateTokens. + rewardsAlloc := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.consumerChain.ChainID) + s.Require().Empty(rewardsAlloc.Rewards) + + // Check that the reward pool still holds the coins from the first transfer, + // which were never allocated since they were not whitelisted rewardCoins = providerBankKeeper.GetAllBalances(s.providerCtx(), rewardPool) - s.Require().Equal(0, len(rewardCoins)) - feeCollectorIbcCoin := providerBankKeeper.GetBalance(s.providerCtx(), authtypes.NewModuleAddress(authtypes.FeeCollectorName), ibcDenom) - s.Require().True(feeCollectorIbcCoin.Amount.Equal(providerExpectedRewards[0].Amount)) - - // Advance a block and check that the coins are transfered from fee collector to fee pool - s.providerChain.NextBlock() - feeCollectorIbcCoin = providerBankKeeper.GetBalance(s.providerCtx(), authtypes.NewModuleAddress(authtypes.FeeCollectorName), ibcDenom) - s.Require().Equal(math.ZeroInt(), feeCollectorIbcCoin.Amount) - - // check that the fee pool has the expected amount of coins - testDistKeeper := s.providerApp.GetTestDistributionKeeper() - // try casting to the sdk distribution keeper - sdkDistKeeper, ok := testDistKeeper.(sdkdistrkeeper.Keeper) - s.Require().True(ok) - s.Require().NotEmpty(sdkDistKeeper) - - feePool, err := sdkDistKeeper.FeePool.Get(s.providerCtx()) - s.Require().NoError(err) - s.Require().NotEmpty(feePool) - - communityCoins := feePool.GetCommunityPool() - s.Require().True(communityCoins[ibcCoinIndex].Amount.Equal(sdk.NewDecCoinFromCoin(providerExpectedRewards[0]).Amount)) + s.Require().Equal(rewardCoins.AmountOf(rewardsIBCdenom), providerExpRewardsAmount) + + // Check that the distribution module account balance is equal to the consumer rewards + consuValsRewardsReceived := consumerValsOutstandingRewardsFunc(s.providerCtx()).Sub(consuValsRewards) + distrAcct := providerDistributionKeeper.GetDistributionAccount(s.providerCtx()) + distrAcctBalance := providerBankKeeper.GetAllBalances(s.providerCtx(), distrAcct.GetAddress()) + + s.Require().Equal( + // ceil the total consumer rewards since the validators allocation use some rounding + consuValsRewardsReceived.AmountOf(rewardsIBCdenom).Ceil(), + math.LegacyNewDecFromInt(distrAcctBalance.AmountOf(rewardsIBCdenom)), + ) } // TestSendRewardsRetries tests that failed reward transmissions are retried every BlocksPerDistributionTransmission blocks @@ -472,6 +506,382 @@ func (s *CCVTestSuite) TestSendRewardsToProvider() { } } +// TestIBCTransferMiddleware tests the logic of the IBC transfer OnRecvPacket callback +func (s *CCVTestSuite) TestIBCTransferMiddleware() { + var ( + data transfertypes.FungibleTokenPacketData + packet channeltypes.Packet + getIBCDenom func(string, string) string + ) + + testCases := []struct { + name string + setup func(sdk.Context, *providerkeeper.Keeper, icstestingutils.TestBankKeeper) + rewardsAllocated bool + expErr bool + }{ + { + "invalid IBC packet", + func(sdk.Context, *providerkeeper.Keeper, icstestingutils.TestBankKeeper) { + packet = channeltypes.Packet{} + }, + false, + true, + }, + { + "IBC packet sender isn't a consumer chain", + func(ctx sdk.Context, keeper *providerkeeper.Keeper, bankKeeper icstestingutils.TestBankKeeper) { + // make the sender consumer chain impossible to identify + packet.DestinationChannel = "CorruptedChannelId" + }, + false, + false, + }, + { + "IBC Transfer recipient is not the consumer rewards pool address", + func(ctx sdk.Context, keeper *providerkeeper.Keeper, bankKeeper icstestingutils.TestBankKeeper) { + data.Receiver = "cosmos149lw9fktlqfed3zt8ah48r5czmsug5s7kw77u9" // random acct address + packet.Data = data.GetBytes() + }, + false, + false, + }, + { + "IBC Transfer coin denom isn't registered", + func(ctx sdk.Context, keeper *providerkeeper.Keeper, bankKeeper icstestingutils.TestBankKeeper) {}, + false, + false, + }, + { + "successful token transfer to empty pool", + func(ctx sdk.Context, keeper *providerkeeper.Keeper, bankKeeper icstestingutils.TestBankKeeper) { + keeper.SetConsumerRewardDenom( + s.providerCtx(), + getIBCDenom(packet.DestinationPort, packet.DestinationChannel), + ) + }, + true, + false, + }, + { + "successful token transfer to filled pool", + func(ctx sdk.Context, keeper *providerkeeper.Keeper, bankKeeper icstestingutils.TestBankKeeper) { + keeper.SetConsumerRewardDenom( + ctx, + getIBCDenom(packet.DestinationPort, packet.DestinationChannel), + ) + + // fill consumer reward pool + bankKeeper.SendCoinsFromAccountToModule( + ctx, + s.providerChain.SenderAccount.GetAddress(), + providertypes.ConsumerRewardsPool, + sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100_000))), + ) + // update consumer allocation + keeper.SetConsumerRewardsAllocation( + ctx, + s.consumerChain.ChainID, + providertypes.ConsumerRewardsAllocation{ + Rewards: sdk.NewDecCoins(sdk.NewDecCoin(sdk.DefaultBondDenom, math.NewInt(100_000))), + }, + ) + }, + true, + false, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + s.SetupTest() + s.SetupCCVChannel(s.path) + s.SetupTransferChannel() + + providerKeeper := s.providerApp.GetProviderKeeper() + bankKeeper := s.providerApp.GetTestBankKeeper() + amount := math.NewInt(100) + + data = transfertypes.NewFungibleTokenPacketData( // can be explicitly changed in setup + sdk.DefaultBondDenom, + amount.String(), + authtypes.NewModuleAddress(consumertypes.ConsumerToSendToProviderName).String(), + providerKeeper.GetConsumerRewardsPoolAddressStr(s.providerCtx()), + "", + ) + + packet = channeltypes.NewPacket( // can be explicitly changed in setup + data.GetBytes(), + uint64(1), + s.transferPath.EndpointA.ChannelConfig.PortID, + s.transferPath.EndpointA.ChannelID, + s.transferPath.EndpointB.ChannelConfig.PortID, + s.transferPath.EndpointB.ChannelID, + clienttypes.NewHeight(1, 100), + 0, + ) + + providerKeeper.SetConsumerRewardDenom(s.providerCtx(), + transfertypes.GetPrefixedDenom( + packet.DestinationPort, + packet.DestinationChannel, + sdk.DefaultBondDenom, + ), + ) + + getIBCDenom = func(dstPort, dstChannel string) string { + return transfertypes.ParseDenomTrace( + transfertypes.GetPrefixedDenom( + packet.DestinationPort, + packet.DestinationChannel, + sdk.DefaultBondDenom, + ), + ).IBCDenom() + } + + tc.setup(s.providerCtx(), &providerKeeper, bankKeeper) + + cbs, ok := s.providerChain.App.GetIBCKeeper().Router.GetRoute(transfertypes.ModuleName) + s.Require().True(ok) + + // save the IBC transfer rewards transferred + rewardsPoolBalance := bankKeeper.GetAllBalances(s.providerCtx(), sdk.MustAccAddressFromBech32(data.Receiver)) + + // save the consumer's rewards allocated + consumerRewardsAllocations := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.consumerChain.ChainID) + + // execute middleware OnRecvPacket logic + ack := cbs.OnRecvPacket(s.providerCtx(), packet, sdk.AccAddress{}) + + // compute expected rewards with provider denom + expRewards := sdk.Coin{ + Amount: amount, + Denom: getIBCDenom(packet.DestinationPort, packet.DestinationChannel), + } + + // compute the balance and allocation difference + rewardsTransferred := bankKeeper.GetAllBalances(s.providerCtx(), sdk.MustAccAddressFromBech32(data.Receiver)). + Sub(rewardsPoolBalance...) + rewardsAllocated := providerKeeper.GetConsumerRewardsAllocation(s.providerCtx(), s.consumerChain.ChainID). + Rewards.Sub(consumerRewardsAllocations.Rewards) + + if !tc.expErr { + s.Require().True(ack.Success()) + // verify that the consumer rewards pool received the IBC coins + s.Require().Equal(rewardsTransferred, sdk.Coins{expRewards}) + + if tc.rewardsAllocated { + // check the data receiver address is set to the consumer rewards pool address + s.Require().Equal(data.GetReceiver(), providerKeeper.GetConsumerRewardsPoolAddressStr(s.providerCtx())) + + // verify that consumer rewards allocation is updated + s.Require().Equal(rewardsAllocated, sdk.NewDecCoinsFromCoins(expRewards)) + } else { + // verify that consumer rewards aren't allocated + s.Require().Empty(rewardsAllocated) + } + } else { + s.Require().False(ack.Success()) + } + }) + } +} + +// TestAllocateTokens is a happy-path test of the consumer rewards pool allocation +// to opted-in validators and the community pool +// func (s *CCVTestSuite) TestAllocateTokens() { +// // set up channel and delegate some tokens in order for validator set update to be sent to the consumer chain +// s.SetupAllCCVChannels() +// providerKeeper := s.providerApp.GetProviderKeeper() +// bankKeeper := s.providerApp.GetTestBankKeeper() +// distributionKeeper := s.providerApp.GetTestDistributionKeeper() + +// totalRewards := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100))} + +// // fund consumer rewards pool +// bankKeeper.SendCoinsFromAccountToModule( +// s.providerCtx(), +// s.providerChain.SenderAccount.GetAddress(), +// providertypes.ConsumerRewardsPool, +// totalRewards, +// ) + +// // Allocate rewards evenly between consumers +// rewardsPerConsumer := totalRewards.QuoInt(math.NewInt(int64(len(s.consumerBundles)))) +// for chainID := range s.consumerBundles { +// // update consumer allocation +// providerKeeper.SetConsumerRewardsAllocation( +// s.providerCtx(), +// chainID, +// providertypes.ConsumerRewardsAllocation{ +// Rewards: sdk.NewDecCoinsFromCoins(rewardsPerConsumer...), +// }, +// ) +// } + +// // Iterate over the validators and +// // store their current voting power and outstanding rewards +// lastValOutRewards := map[string]sdk.DecCoins{} +// for _, val := range s.providerChain.Vals.Validators { +// valRewards := distributionKeeper.GetValidatorOutstandingRewards(s.providerCtx(), sdk.ValAddress(val.Address)) +// lastValOutRewards[sdk.ValAddress(val.Address).String()] = valRewards.Rewards +// } + +// // store community pool balance +// lastCommPool := distributionKeeper.GetFeePoolCommunityCoins(s.providerCtx()) + +// // execute BeginBlock to trigger the token allocation +// providerKeeper.BeginBlockRD(s.providerCtx()) + +// valNum := len(s.providerChain.Vals.Validators) +// consuNum := len(s.consumerBundles) + +// // compute the expected validators token allocation by subtracting the community tax +// rewardsPerConsumerDec := sdk.NewDecCoinsFromCoins(rewardsPerConsumer...) +// communityTax := distributionKeeper.GetCommunityTax(s.providerCtx()) +// validatorsExpRewards := rewardsPerConsumerDec. +// MulDecTruncate(math.LegacyOneDec().Sub(communityTax)). +// // multiply by the number of consumers since all the validators opted in +// MulDec(sdk.NewDec(int64(consuNum))) +// perValExpReward := validatorsExpRewards.QuoDec(sdk.NewDec(int64(valNum))) + +// // verify the validator tokens allocation +// // note that the validators have the same voting power to keep things simple +// for _, val := range s.providerChain.Vals.Validators { +// valRewards := distributionKeeper.GetValidatorOutstandingRewards(s.providerCtx(), sdk.ValAddress(val.Address)) +// s.Require().Equal( +// valRewards.Rewards, +// lastValOutRewards[sdk.ValAddress(val.Address).String()].Add(perValExpReward...), +// ) +// } + +// commPoolExpRewards := sdk.NewDecCoinsFromCoins(totalRewards...).Sub(validatorsExpRewards) +// currCommPool := distributionKeeper.GetFeePoolCommunityCoins(s.providerCtx()) + +// s.Require().Equal(currCommPool, (lastCommPool.Add(commPoolExpRewards...))) +// } + +// TestAllocateTokens is a unit-test for TransferConsumerRewardsToDistributionModule() +// but is written as an integration test to avoid excessive mocking. +func (s *CCVTestSuite) TransferConsumerRewardsToDistributionModule() { + testCases := []struct { + name string + rewardsPool sdk.Coins + rewardsAlloc sdk.DecCoins + expErr bool + }{ + { + "empty consumer rewards pool", + sdk.Coins{}, + sdk.DecCoins{}, + false, + }, + { + "empty consumer allocation", + sdk.Coins{ + sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100)), + }, + sdk.DecCoins{}, + false, + }, + { + "equal consumer rewards pool and allocation", + sdk.Coins{ + sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100)), + }, + sdk.DecCoins{ + sdk.NewDecCoin(sdk.DefaultBondDenom, math.NewInt(100)), + }, + false, + }, + { + "less consumer rewards than allocation", + sdk.Coins{ + sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(90)), + }, + sdk.DecCoins{ + sdk.NewDecCoin(sdk.DefaultBondDenom, math.NewInt(100)), + }, + true, + }, + { + "remaining consumer rewards allocation", + sdk.Coins{ + sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100)), + }, + sdk.DecCoins{ + sdk.DecCoin{ + Denom: sdk.DefaultBondDenom, + Amount: math.LegacyNewDecWithPrec(995, 1), + }, + }, + false, + }, + } + + providerKeeper := s.providerApp.GetProviderKeeper() + bankKeeper := s.providerApp.GetTestBankKeeper() + distributionKeeper := s.providerApp.GetTestDistributionKeeper() + + chainID := s.consumerChain.ChainID + + for _, tc := range testCases { + s.Run(tc.name, func() { + ctx, _ := s.providerCtx().CacheContext() + // fund consumer rewards pool + bankKeeper.SendCoinsFromAccountToModule( + ctx, + s.providerChain.SenderAccount.GetAddress(), + providertypes.ConsumerRewardsPool, + tc.rewardsPool, + ) + + // update consumer rewars allocation + providerKeeper.SetConsumerRewardsAllocation( + ctx, + chainID, + providertypes.ConsumerRewardsAllocation{ + Rewards: tc.rewardsAlloc, + }, + ) + + // store pool balance + oldPool := bankKeeper.GetAllBalances( + ctx, + distributionKeeper.GetDistributionAccount(ctx).GetAddress(), + ) + + coinsTransferred, _ := providerKeeper.GetConsumerRewardsAllocation(ctx, chainID).Rewards.TruncateDecimal() + // // transfer consumer rewards to distribution module + // coinsTransferred, err := providerKeeper.TransferConsumerRewardsToDistributionModule( + // ctx, + // chainID, + // ) + // if tc.expErr { + // s.Require().Error(err) + // return + // } + + // check remaining consumer rewards allocation + expCoinTransferred, expRemaining := tc.rewardsAlloc.TruncateDecimal() + s.Require().Equal(expCoinTransferred, coinsTransferred) + + s.Require().Equal( + expRemaining, + providerKeeper.GetConsumerRewardsAllocation(ctx, chainID).Rewards, + ) + + // check updated consuemer rewards pool balance + newPool := bankKeeper.GetAllBalances( + ctx, + distributionKeeper.GetDistributionAccount(ctx).GetAddress(), + ) + + s.Require().Equal(newPool.Sub(oldPool...), coinsTransferred) + }) + } +} + // getEscrowBalance gets the current balances in the escrow account holding the transferred tokens to the provider func (s *CCVTestSuite) getEscrowBalance() sdk.Coins { consumerBankKeeper := s.consumerApp.GetTestBankKeeper() @@ -503,3 +913,212 @@ func (s *CCVTestSuite) prepareRewardDist() { blocksToGo := bpdt - blocksSinceLastTrans s.coordinator.CommitNBlocks(s.consumerChain, uint64(blocksToGo)) } + +func (s *CCVTestSuite) TestAllocateTokensToValidator() { + providerKeeper := s.providerApp.GetProviderKeeper() + distributionKeeper := s.providerApp.GetTestDistributionKeeper() + bankKeeper := s.providerApp.GetTestBankKeeper() + + chainID := s.consumerChain.ChainID + + testCases := []struct { + name string + consuValLen int + tokens sdk.DecCoins + rate math.LegacyDec + expAllocated sdk.DecCoins + }{ + { + name: "tokens are empty", + tokens: sdk.DecCoins{}, + rate: math.LegacyZeroDec(), + expAllocated: nil, + }, + { + name: "consumer valset is empty - total voting power is zero", + tokens: sdk.DecCoins{sdk.NewDecCoin(sdk.DefaultBondDenom, math.NewInt(100_000))}, + rate: math.LegacyZeroDec(), + expAllocated: nil, + }, + { + name: "expect all tokens to be allocated to a single validator", + consuValLen: 1, + tokens: sdk.DecCoins{sdk.NewDecCoin(sdk.DefaultBondDenom, math.NewInt(999))}, + rate: math.LegacyNewDecWithPrec(5, 1), + expAllocated: sdk.DecCoins{sdk.NewDecCoin(sdk.DefaultBondDenom, math.NewInt(999))}, + }, + { + name: "expect tokens to be allocated evenly between validators", + consuValLen: 2, + tokens: sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, math.LegacyNewDecFromIntWithPrec(math.NewInt(999), 2))}, + rate: math.LegacyOneDec(), + expAllocated: sdk.DecCoins{sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, math.LegacyNewDecFromIntWithPrec(math.NewInt(999), 2))}, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + ctx, _ := s.providerCtx().CacheContext() + + // change the consumer valset + consuVals := providerKeeper.GetConsumerValSet(ctx, chainID) + providerKeeper.DeleteConsumerValSet(ctx, chainID) + providerKeeper.SetConsumerValSet(ctx, chainID, consuVals[0:tc.consuValLen]) + consuVals = providerKeeper.GetConsumerValSet(ctx, chainID) + + // set the same consumer commission rate for all consumer validators + for _, v := range consuVals { + provAddr := providertypes.NewProviderConsAddress(sdk.ConsAddress(v.ProviderConsAddr)) + err := providerKeeper.SetConsumerCommissionRate( + ctx, + chainID, + provAddr, + tc.rate, + ) + s.Require().NoError(err) + } + + // allocate tokens + res := providerKeeper.AllocateTokensToConsumerValidators( + ctx, + chainID, + tc.tokens, + ) + + // check that the expected result is returned + s.Require().Equal(tc.expAllocated, res) + + if !tc.expAllocated.Empty() { + // rewards are expected to be allocated evenly between validators + rewardsPerVal := tc.expAllocated.QuoDec(math.LegacyNewDec(int64(len(consuVals)))) + + // check that the rewards are allocated to validators + for _, v := range consuVals { + valAddr := sdk.ValAddress(v.ProviderConsAddr) + rewards, err := s.providerApp.GetTestDistributionKeeper().GetValidatorOutstandingRewards( + ctx, + valAddr, + ) + s.Require().NoError(err) + s.Require().Equal(rewardsPerVal, rewards.Rewards) + + // send rewards to the distribution module + valRewardsTrunc, _ := rewards.Rewards.TruncateDecimal() + err = bankKeeper.SendCoinsFromAccountToModule( + ctx, + s.providerChain.SenderAccount.GetAddress(), + distrtypes.ModuleName, + valRewardsTrunc) + s.Require().NoError(err) + + // check that validators can withdraw their rewards + withdrawnCoins, err := distributionKeeper.WithdrawValidatorCommission( + ctx, + valAddr, + ) + s.Require().NoError(err) + + // check that the withdrawn coins is equal to the entire reward amount + // times the set consumer commission rate + commission := rewards.Rewards.MulDec(tc.rate) + c, _ := commission.TruncateDecimal() + s.Require().Equal(withdrawnCoins, c) + + // check that validators get rewards in their balance + s.Require().Equal(withdrawnCoins, bankKeeper.GetAllBalances(ctx, sdk.AccAddress(valAddr))) + } + } else { + for _, v := range consuVals { + valAddr := sdk.ValAddress(v.ProviderConsAddr) + rewards, err := s.providerApp.GetTestDistributionKeeper().GetValidatorOutstandingRewards( + ctx, + valAddr, + ) + s.Require().NoError(err) + s.Require().Zero(rewards.Rewards) + } + } + }) + } +} + +// TestMultiConsumerRewardsDistribution tests the rewards distribution of multiple consumers chains +func (s *CCVTestSuite) TestMultiConsumerRewardsDistribution() { + s.SetupAllCCVChannels() + s.SetupAllTransferChannels() + + providerBankKeeper := s.providerApp.GetTestBankKeeper() + providerAccountKeeper := s.providerApp.GetTestAccountKeeper() + + // check that the reward provider pool is empty + rewardPool := providerAccountKeeper.GetModuleAccount(s.providerCtx(), providertypes.ConsumerRewardsPool).GetAddress() + rewardCoins := providerBankKeeper.GetAllBalances(s.providerCtx(), rewardPool) + s.Require().Empty(rewardCoins) + + // totalConsumerRewards := sdk.Coins{} + + // Iterate over the consumers and perform the reward distribution + // to the provider + for chainID := range s.consumerBundles { + bundle := s.consumerBundles[chainID] + consumerKeeper := bundle.App.GetConsumerKeeper() + bankKeeper := bundle.App.GetTestBankKeeper() + accountKeeper := bundle.App.GetTestAccountKeeper() + + // set the consumer reward denom and the block per distribution params + params := consumerKeeper.GetConsumerParams(bundle.GetCtx()) + params.RewardDenoms = []string{sdk.DefaultBondDenom} + // set the reward distribution to be performed during the next block + params.BlocksPerDistributionTransmission = int64(1) + consumerKeeper.SetParams(bundle.GetCtx(), params) + + // transfer the consumer reward pool to the provider + var rewardsPerConsumer sdk.Coin + + // check the consumer pool balance + // Note that for a democracy consumer chain the pool may already be filled + pool := bankKeeper.GetAllBalances( + bundle.GetCtx(), + accountKeeper.GetModuleAccount(bundle.GetCtx(), consumertypes.ConsumerToSendToProviderName).GetAddress(), + ) + if pool.Empty() { + // if pool is empty, fill it with some tokens + rewardsPerConsumer = sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100)) + err := bankKeeper.SendCoinsFromAccountToModule( + bundle.GetCtx(), + bundle.Chain.SenderAccount.GetAddress(), + consumertypes.ConsumerToSendToProviderName, + sdk.NewCoins(rewardsPerConsumer), + ) + s.Require().NoError(err) + } + + // perform the reward transfer + bundle.Chain.NextBlock() + + // construct the denom of the reward tokens for the provider + prefixedDenom := transfertypes.GetPrefixedDenom( + transfertypes.PortID, + bundle.TransferPath.EndpointB.ChannelID, + rewardsPerConsumer.Denom, + ) + provIBCDenom := transfertypes.ParseDenomTrace(prefixedDenom).IBCDenom() + + providerRewards := providerBankKeeper.GetBalance(s.providerCtx(), rewardPool, prefixedDenom) + + // relay IBC transfer packet from consumer to provider + // Note that relaying increases the pool rewards with the democracy consumers + relayAllCommittedPackets( + s, + bundle.Chain, + bundle.TransferPath, + transfertypes.PortID, + bundle.TransferPath.EndpointA.ChannelID, + 1, + ) + + // Check the provider received the rewards + providerRewardsDelta := providerBankKeeper.GetBalance(s.providerCtx(), rewardPool, prefixedDenom).Sub(providerRewards) + s.Require().True(providerRewardsDelta.Amount.GTE(pool.AmountOf(provIBCDenom))) + } +} diff --git a/tests/integration/key_assignment.go b/tests/integration/key_assignment.go index b600c46b19..8d8826daf9 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -79,7 +79,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { }, false, 2, }, { - "double same-key assignment in same block", func(pk *providerkeeper.Keeper) error { + "double same-key assignment in same block by different vals", func(pk *providerkeeper.Keeper) error { // establish CCV channel s.SetupCCVChannel(s.path) @@ -90,8 +90,9 @@ func (s *CCVTestSuite) TestKeyAssignment() { return err } - // same key assignment - err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + // same key assignment, but different validator + validator2, _ := generateNewConsumerKey(s, 1) + err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator2, consumerKey) if err != nil { return err } @@ -100,6 +101,28 @@ func (s *CCVTestSuite) TestKeyAssignment() { return nil }, true, 2, }, + { + "double same-key assignment in same block by same val", func(pk *providerkeeper.Keeper) error { + // establish CCV channel + s.SetupCCVChannel(s.path) + + // key assignment + validator, consumerKey := generateNewConsumerKey(s, 0) + err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + if err != nil { + return err + } + + // same key assignment, but different validator + err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + if err != nil { + return err + } + s.nextEpoch() + + return nil + }, false, 2, + }, { "double key assignment in same block", func(pk *providerkeeper.Keeper) error { // establish CCV channel @@ -124,7 +147,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { }, false, 2, }, { - "double same-key assignment in different blocks", func(pk *providerkeeper.Keeper) error { + "double same-key assignment in different blocks by different vals", func(pk *providerkeeper.Keeper) error { // establish CCV channel s.SetupCCVChannel(s.path) @@ -137,7 +160,8 @@ func (s *CCVTestSuite) TestKeyAssignment() { s.nextEpoch() // same key assignment - err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + validator2, _ := generateNewConsumerKey(s, 1) + err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator2, consumerKey) if err != nil { return err } @@ -146,6 +170,29 @@ func (s *CCVTestSuite) TestKeyAssignment() { return nil }, true, 2, }, + { + "double same-key assignment in different blocks by same val", func(pk *providerkeeper.Keeper) error { + // establish CCV channel + s.SetupCCVChannel(s.path) + + // key assignment + validator, consumerKey := generateNewConsumerKey(s, 0) + err := pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + if err != nil { + return err + } + s.nextEpoch() + + // same key assignment + err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) + if err != nil { + return err + } + s.nextEpoch() + + return nil + }, false, 2, + }, { "double key assignment in different blocks", func(pk *providerkeeper.Keeper) error { // establish CCV channel diff --git a/tests/integration/provider_gov_hooks.go b/tests/integration/provider_gov_hooks.go index d1970c1b72..6c99f17c64 100644 --- a/tests/integration/provider_gov_hooks.go +++ b/tests/integration/provider_gov_hooks.go @@ -38,7 +38,8 @@ func (s *CCVTestSuite) TestAfterPropSubmissionAndVotingPeriodEnded() { providerKeeper.Hooks().AfterProposalSubmission(ctx, proposal.Id) // verify that the proposal ID is created - proposalIdOnProvider := providerKeeper.GetProposedConsumerChain(ctx, proposal.Id) + proposalIdOnProvider, ok := providerKeeper.GetProposedConsumerChain(ctx, proposal.Id) + s.Require().True(ok) s.Require().NotEmpty(proposalIdOnProvider) s.Require().Equal(content.ChainId, proposalIdOnProvider) diff --git a/tests/integration/setup.go b/tests/integration/setup.go index d8d3f3107b..eeb980200f 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -160,12 +160,16 @@ func (suite *CCVTestSuite) SetupTest() { providerKeeper.DeletePendingConsumerAdditionProps(suite.providerCtx(), ps...) // start consumer chains - numConsumers := 5 suite.consumerBundles = make(map[string]*icstestingutils.ConsumerBundle) - for i := 0; i < numConsumers; i++ { + for i := 0; i < icstestingutils.NumConsumers; i++ { bundle := suite.setupConsumerCallback(&suite.Suite, suite.coordinator, i) suite.consumerBundles[bundle.Chain.ChainID] = bundle suite.registerPacketSniffer(bundle.Chain) + + // check that TopN is correctly set for the consumer + topN, found := providerKeeper.GetTopN(suite.providerCtx(), bundle.Chain.ChainID) + suite.Require().True(found) + suite.Require().Equal(bundle.TopN, topN) } // initialize each consumer chain with it's corresponding genesis state @@ -249,7 +253,6 @@ func initConsumerChain( ) s.Require().True(found, "provider endpoint clientID not found") bundle.Path.EndpointB.ClientID = providerEndpointClientID - // Set consumer endpoint's clientID consumerKeeper := bundle.GetKeeper() consumerEndpointClientID, found := consumerKeeper.GetProviderClientID(bundle.GetCtx()) @@ -329,34 +332,70 @@ func (suite *CCVTestSuite) ExecuteCCVChannelHandshake(path *ibctesting.Path) { // TODO: Make SetupTransferChannel functional for multiple consumers by pattern matching SetupCCVChannel. // See: https://github.com/cosmos/interchain-security/issues/506 +// SetupTransferChannel setup the transfer channel of the first consumer chain among multiple func (suite *CCVTestSuite) SetupTransferChannel() { - // transfer path will use the same connection as ccv path + suite.setupTransferChannel( + suite.transferPath, + suite.path, + suite.consumerApp.GetConsumerKeeper().GetDistributionTransmissionChannel( + suite.consumerChain.GetContext(), + ), + ) +} - suite.transferPath.EndpointA.ClientID = suite.path.EndpointA.ClientID - suite.transferPath.EndpointA.ConnectionID = suite.path.EndpointA.ConnectionID - suite.transferPath.EndpointB.ClientID = suite.path.EndpointB.ClientID - suite.transferPath.EndpointB.ConnectionID = suite.path.EndpointB.ConnectionID +func (suite *CCVTestSuite) setupTransferChannel( + transferPath *ibctesting.Path, + ccvPath *ibctesting.Path, + channelID string, +) { + // transfer path will use the same connection as ccv path + transferPath.EndpointA.ClientID = ccvPath.EndpointA.ClientID + transferPath.EndpointA.ConnectionID = ccvPath.EndpointA.ConnectionID + transferPath.EndpointB.ClientID = ccvPath.EndpointB.ClientID + transferPath.EndpointB.ConnectionID = ccvPath.EndpointB.ConnectionID // CCV channel handshake will automatically initiate transfer channel handshake on ACK // so transfer channel will be on stage INIT when CompleteSetupCCVChannel returns. - suite.transferPath.EndpointA.ChannelID = suite.consumerApp.GetConsumerKeeper().GetDistributionTransmissionChannel( - suite.consumerChain.GetContext()) + transferPath.EndpointA.ChannelID = channelID // Complete TRY, ACK, CONFIRM for transfer path - err := suite.transferPath.EndpointB.ChanOpenTry() + err := transferPath.EndpointB.ChanOpenTry() suite.Require().NoError(err) - err = suite.transferPath.EndpointA.ChanOpenAck() + err = transferPath.EndpointA.ChanOpenAck() suite.Require().NoError(err) - err = suite.transferPath.EndpointB.ChanOpenConfirm() + err = transferPath.EndpointB.ChanOpenConfirm() suite.Require().NoError(err) // ensure counterparty is up to date - err = suite.transferPath.EndpointA.UpdateClient() + err = transferPath.EndpointA.UpdateClient() suite.Require().NoError(err) } +// SetupAllTransferChannel setup all consumer chains transfer channel +func (suite *CCVTestSuite) SetupAllTransferChannels() { + // setup the first consumer transfer channel + suite.SetupTransferChannel() + + // setup all the remaining consumers transfer channels + for chainID := range suite.consumerBundles { + // skip fist consumer + if chainID == suite.consumerChain.ChainID { + continue + } + + // get the bundle for the chain ID + bundle := suite.consumerBundles[chainID] + // setup the transfer channel + suite.setupTransferChannel( + bundle.TransferPath, + bundle.Path, + bundle.App.GetConsumerKeeper().GetDistributionTransmissionChannel(bundle.GetCtx()), + ) + } +} + func (s CCVTestSuite) validateEndpointsClientConfig(consumerBundle icstestingutils.ConsumerBundle) { //nolint:govet // this is a test so we can copy locks consumerKeeper := consumerBundle.GetKeeper() providerStakingKeeper := s.providerApp.GetTestStakingKeeper() diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index de5c7171e9..9f29c2806c 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -414,6 +414,15 @@ func (suite *CCVTestSuite) TestOnRecvSlashPacketErrors() { // Check expected behavior for handling SlashPackets for downtime infractions slashPacketData.Infraction = stakingtypes.Infraction_INFRACTION_DOWNTIME + // Expect packet to be handled if the validator didn't opt in + ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData) + suite.Require().NoError(err, "no error expected") + suite.Require().Equal(ccv.SlashPacketHandledResult, ackResult, "expected successful ack") + + providerKeeper.SetConsumerValidator(ctx, firstBundle.Chain.ChainID, providertypes.ConsumerValidator{ + ProviderConsAddr: validAddress, + }) + // Expect the packet to bounce if the slash meter is negative providerKeeper.SetSlashMeter(ctx, math.NewInt(-1)) ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index b56222cb87..81d39d5e70 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -12,6 +12,7 @@ import ( commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v8/testing" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" "github.com/stretchr/testify/require" "cosmossdk.io/math" @@ -376,7 +377,8 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC stakingValidators = append(stakingValidators, v) } - nextValidators := s.providerKeeper().ComputeNextEpochConsumerValSet(s.providerCtx(), string(consumerChainId), stakingValidators) + considerAll := func(providerAddr providertypes.ProviderConsAddress) bool { return true } + nextValidators := s.providerKeeper().FilterValidators(s.providerCtx(), string(consumerChainId), stakingValidators, considerAll) s.providerKeeper().SetConsumerValSet(s.providerCtx(), string(consumerChainId), nextValidators) err = s.providerKeeper().SetConsumerGenesis( @@ -385,6 +387,9 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC consumerGenesisForProvider) require.NoError(s.t, err, "Error setting consumer genesis on provider for chain %v", consumerChain.ChainID) + // set the top N percentage to 100 to simulate a full consumer + s.providerKeeper().SetTopN(providerChain.GetContext(), consumerChain.ChainID, 100) + // Client ID is set in InitGenesis and we treat it as a black box. So // must query it to use it with the endpoint. clientID, _ := s.consumerKeeper(consumerChainId).GetProviderClientID(s.ctx(consumerChainId)) diff --git a/tests/mbt/model/README.md b/tests/mbt/model/README.md index b8ce579440..f4add0e213 100644 --- a/tests/mbt/model/README.md +++ b/tests/mbt/model/README.md @@ -32,6 +32,8 @@ All the logic in EndBlock/BeginBlock happens here, like updating the validator s * `DeliverVscPacket(receiver: Chain)`: Delivers a pending VSCPacket from the provider to the consumer `receiver`. * `DeliverPacketToProvider(sender: Chain)`: Delivers a pending packet from the consumer `sender` to the provider. * `KeyAssignment(chain: Chain, validator: Node, consumerAddr: ConsumerAddr)` (only when running with `--step stepKeyAssignment`): Assigns the `consumerAddr` to the `validator` on the `chain`. Note that we use "key" and "consumerAddr" pretty much interchangeably, as the model makes no differentiation between private keys, public keys, addresses, etc, as it doesn't model the cryptography. +* `OptIn(chain: Chain, validator: Node)` (only when running with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`): The `validator` opts in on the `chain`. +* `OptOut(chain: Chain, validator: Node)` (only when running with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`): The `validator` opts out on the `chain`. ### State machines @@ -51,6 +53,12 @@ To run with key assignment, specify the step flag: `--step stepKeyAssignment`. KeyAssignment also needs some different invariants, see below. +#### Partial Set Security + +To run with Partial Set Security, specify the step flag `--step stepBoundedDriftKeyAndPSS`. +This runs both PSS and Key Assignment. +It also requires running with `ccv_boundeddrift.qnt`, see below. + #### ccv_boundeddrift.qnt This state machine layer is more restricted to generate more interesting traces: * It never allows consumer chains to drift more than `MaxDrift` time apart from each other. @@ -75,10 +83,8 @@ traces are not very useful for testing. To run unit tests, run ``` -quint test ccv_test.qnt -``` -and -``` +quint test ccv_test.qnt; +quint test ccv_pss_test.qnt; quint test ccv_model.qnt ``` @@ -132,4 +138,8 @@ The available sanity checks are: - CanSendVscMaturedPackets - CanReceiveMaturations - CanAssignConsumerKey (only with `--step stepKeyAssignment`) -- CanHaveConsumerAddresses (only with `--step stepKeyAssignment`) \ No newline at end of file +- CanHaveConsumerAddresses (only with `--step stepKeyAssignment`) +- CanOptIn (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`) +- CanOptOut (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`) +- CanFailOptOut (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`) +- CanHaveOptIn (only with `--step stepBoundedDriftKeyAndPSS` on `ccv_boundeddrift.qnt`) diff --git a/tests/mbt/model/ccv.qnt b/tests/mbt/model/ccv.qnt index 87ddc91ea2..80aed91ec2 100644 --- a/tests/mbt/model/ccv.qnt +++ b/tests/mbt/model/ccv.qnt @@ -908,14 +908,18 @@ module ccv { // (in general, the validator is a consumer address and could be an assigned one) val slashFactor = DowntimeSlashPercentage + + val curValPowerIsZero = currentState.providerState.chainState.currentValidatorPowers.get(providerVal) == 0 - val newProviderState = currentState.providerState - .jailUntil(providerVal, jailEndTime) + val newProviderState = if (not(curValPowerIsZero)) + currentState.providerState + .jailUntil(providerVal, jailEndTime) else + currentState.providerState // validators with zero power are not jailed // // slashing is currently not enabled in ICS // .slash(packet.validator, packet.valPower, slashFactor) // if the validator did not have voting power of 0 or was already jailed before, the validator set will change due to the slash - val valSetChanged = currentState.providerState.chainState.currentValidatorPowers.get(providerVal) != 0 + val valSetChanged = not(curValPowerIsZero) // add the consumer address to the list of acknowledged slashes // for the sender chain of this slash packet and indicate that we need to send a packet at endblock diff --git a/tests/mbt/model/ccv_model.qnt b/tests/mbt/model/ccv_model.qnt index e2b812e212..312f6a5bdb 100644 --- a/tests/mbt/model/ccv_model.qnt +++ b/tests/mbt/model/ccv_model.qnt @@ -216,11 +216,14 @@ module ccv_model { // stepCommon is the core functionality of steps that does not have anything to do with time. action stepCommon = any { - nondet node = oneOf(nonJailedNodes(currentState.providerState)) - // very restricted set of voting powers. exact values are not important, - // and this keeps the state space smaller. - nondet newVotingPower = oneOf(Set(-50, 50)) - VotingPowerChange(node, newVotingPower), + all { + currentState.providerState.validatorsWithPower().size() > 0, + nondet node = oneOf(currentState.providerState.validatorsWithPower()) + // very restricted set of voting powers. exact values are not important, + // and this keeps the state space smaller. + nondet newVotingPower = oneOf(Set(-50, 50)) + VotingPowerChange(node, newVotingPower), + }, // try to send a packet. we could filter by chains that can actually send, // but it's probably not much faster than just trying and failing. @@ -749,7 +752,8 @@ module ccv_model { action nondetKeyAssignment = all { runningConsumers.size() > 0, - nondet node = oneOf(nodes) + currentState.providerState.validatorsWithPower().size() > 0, + nondet node = oneOf(currentState.providerState.validatorsWithPower()) nondet consumerAddr = oneOf(consumerAddresses) nondet consumer = oneOf(runningConsumers) KeyAssignment(consumer, node, consumerAddr), diff --git a/tests/mbt/model/ccv_pss.qnt b/tests/mbt/model/ccv_pss.qnt new file mode 100644 index 0000000000..26aee28d56 --- /dev/null +++ b/tests/mbt/model/ccv_pss.qnt @@ -0,0 +1,157 @@ +// This module contains logic for PSS (Partial Set Security). +// PSS is a variant/extension of CCV that +// allows for only a subset of the validator set +// to secure a consumer chain. +// Not all logic related to PSS is inside this module, as some logic is +// too tightly coupled with the core CCV logic, +// which is instead found in ccv.qnt +module ccv_pss { + import ccv_types.* from "./ccv" + import extraSpells.* from "./libraries/extraSpells" + import ccv_utils.* from "./ccv_utils" + + // Given a base validator set, an N for a top N chain, and a set of validators that have opted in to the chain, + // returns the validator set that should be sent to the chain. + // Assumes that the value for N is valid. + pure def GetPSSValidatorSet(providerState: ProviderState, origValSet: ValidatorSet, consumer: Chain): ValidatorSet = { + pure val optedInVals = providerState.optedInVals.getOrElse(consumer, Set()) + GetPSSValidatorSet_helper(origValSet, optedInVals) + } + + pure def GetPSSValidatorSet_helper(origValSet: ValidatorSet, optedInVals: Set[Node]): ValidatorSet = { + origValSet.mapFilter(v => optedInVals.contains(v)) + } + + // Given a validator set and N, returns the top N% of validators by power. + // Note that in the edge case of multiple validators having the same power, + // this will always include all validators with the same power as the lowest top N validator. + pure def GetTopNVals(origValSet: ValidatorSet, N: int): Set[Node] = { + // == sort validators by power == + // define a comparator that compares validators by power + pure def powerCompare(a: Node, b: Node): Ordering = { + pure val powA = origValSet.get(a) + pure val powB = origValSet.get(b) + intCompare(powB, powA) + } + // get a sorted list of validators by power + pure val sortedVals = origValSet.keys().toSortedList(powerCompare) + + // == compute the threshold of how much power the top N have == + pure val totalPower = origValSet.mapValuesSum() + pure val topNPower = totalPower * N / 100 + + // == construct the validator set by going through the sorted vals == + pure val res = sortedVals.foldl( + // accumulator carries 4 values: + // * set of vals in top N (starts with empty set) + // * total power added so far (starts with 0) + // * whether we should add the next validator if it has the same power as the previous one, + // regardless of total power (starts with false) + // * the power of the last validator added (starts with 0) + (Set(), 0, false, 0), + (acc, validator) => + pure val curValSet = acc._1 + pure val accPower = acc._2 + pure val shouldAddSamePow = acc._3 + pure val lastPow = acc._4 + + pure val validatorPower = origValSet.get(validator) + if (validatorPower == lastPow and shouldAddSamePow) { + // we should add the validator because it has the same power as the previous one, + // and we add regardless of total power because we need to include all + // vals with the same power if we include one of them + pure val newAccPower = accPower + validatorPower + (curValSet.union(Set(validator)), newAccPower, true, validatorPower) + } else if (validatorPower > 0 and accPower < topNPower) { + // if we don't have enough power yet, add the validator to the set + pure val newAccPower = accPower + validatorPower + (curValSet.union(Set(validator)), newAccPower, true, validatorPower) + } else { + // if we have enough power and we also are done adding + // all validators with the same power as the lowest top N validator, + // don't add them + (curValSet, accPower, false, 0) + } + ) + res._1 + } + + // Opts a validator in for a consumer chain the provider. + // Possible before the consumer chain starts running, + // and will then be applied when the consumer chain starts running. + pure def OptIn(currentState: ProtocolState, consumer: Chain, validator: Node): Result = { + pure val optedInVals = currentState.providerState.optedInVals.get(consumer) + pure val newOptedInVals = optedInVals.union(Set(validator)) + Ok({ + ...currentState, + providerState: { + ...currentState.providerState, + optedInVals: currentState.providerState.optedInVals.put(consumer, newOptedInVals) + } + }) + } + + // Returns true if the given validator is in the top N for the given consumer chain, + // and false otherwise. + pure def IsTopN(currentState: ProtocolState, validator: Node, consumer: Chain): bool = { + val proviValSet = currentState.providerState.chainState.votingPowerHistory.head() + val N = currentState.providerState.topNByConsumer.get(consumer) + + val topNValSet = GetTopNVals(proviValSet, N) + + topNValSet.contains(validator) + } + + // Returns true if the given validator has opted in to the given consumer chain, + pure def IsOptedIn(currentState: ProtocolState, validator: Node, consumer: Chain): bool = { + currentState.providerState.optedInVals.getOrElse(consumer, Set()).contains(validator) + } + + // Opts a validator out. Safe to call before the consumer chain even runs. + // Will not stop the validator set from being forced to validate when in the top N. + // Validators that are in the top N will not be able to opt out, and + // an error will be returned. + // Similarly, if the validator is not opted in, an error will be returned. + pure def OptOut(currentState: ProtocolState, consumer: Chain, validator: Node): Result = { + if (currentState.IsTopN(validator, consumer)) { + Err("Cannot opt out a validator that is in the top N") + } else if (not(currentState.IsOptedIn(validator, consumer))) { + Err("Cannot opt out a validator that is not opted in") + } else { + pure val optedInVals = currentState.providerState.optedInVals.get(consumer) + pure val newOptedInVals = optedInVals.exclude(Set(validator)) + Ok({ + ...currentState, + providerState: { + ...currentState.providerState, + optedInVals: currentState.providerState.optedInVals.put(consumer, newOptedInVals) + } + }) + } + } + + // Runs the PSS logic that needs to run on endblock. + // Concretely, this will forcefully opt in all validators that are in the top N + // for each chain. + pure def endBlockPSS(providerState: ProviderState): ProviderState = { + val runningConsumers = providerState.getRunningConsumers() + runningConsumers.fold( + providerState, + (acc, consumer) => endBlockPSS_helper(acc, consumer) + ) + } + + // Runs the PSS logic for a single consumer. + // Should only be run for running chains. + pure def endBlockPSS_helper(providerState: ProviderState, consumer: Chain): ProviderState = { + val proviValSet = providerState.chainState.currentValidatorPowers + val topNVals = GetTopNVals(proviValSet, providerState.topNByConsumer.get(consumer)) + val prevOptedInVals = providerState.optedInVals.getOrElse(consumer, Set()) + // opt in all the top N validators, i.e. union the top N vals with the previous opted in vals + val newOptedInVals = providerState.optedInVals.put(consumer, prevOptedInVals.union(topNVals)) + { + ...providerState, + optedInVals: newOptedInVals + } + } +} \ No newline at end of file diff --git a/tests/mbt/model/ccv_pss_model.qnt b/tests/mbt/model/ccv_pss_model.qnt new file mode 100644 index 0000000000..9e60e241bc --- /dev/null +++ b/tests/mbt/model/ccv_pss_model.qnt @@ -0,0 +1,113 @@ +module ccv_pss_model { + import ccv_types.* from "./ccv" + import ccv_model.* from "./ccv_model" + import ccv_pss.* from "./ccv_pss" + import extraSpells.* from "./libraries/extraSpells" + + action StepOptIn(): bool = { + all { + runningConsumers.size() > 0, + nondet consumer = oneOf(runningConsumers) + nondet validator = oneOf(nodes) + OptIn_Deterministic(consumer, validator) + } + } + + action OptIn_Deterministic(consumer: Chain, validator: Node): bool = { + val res = OptIn(currentState, consumer, validator) + all { + currentState' = res.newState, + trace' = trace.append( + { + ...emptyAction, + kind: "OptIn", + consumerChain: consumer, + validator: validator + } + ), + params' = params, + } + } + + action StepOptOut(): bool = { + all { + runningConsumers.size() > 0, + nondet consumer = oneOf(runningConsumers) + nondet validator = oneOf(nodes) + OptOut_Deterministic(consumer, validator) + } + } + + action OptOut_Deterministic(consumer: Chain, validator: Node): bool = { + val res = OptOut(currentState, consumer, validator) + all { + // if we expect an error, this should be a noop + currentState' = if (res.error == "") res.newState else currentState, + trace' = trace.append( + { + ...emptyAction, + kind: "OptOut", + consumerChain: consumer, + validator: validator, + expectedError: res.error + } + ), + params' = params, + } + } + + // Different sets of possible values for the topN parameter. + val allFullConsumers: Set[int] = Set(100) + val allOptIn: Set[int] = Set(0) + // only choose a few values for top N here to not make the "edge cases" of 0 and 100 too unlikely + val variousPossibleTopN: Set[int] = Set(50, 70, 80, 90, 100) + + // INVARIANTS + + // For a consumer chain with a given top N value, + // the total VP on the consumer is at least N% of the total VP of some historical val set on the provider. + val AtLeastTopNPower: bool = + runningConsumers.forall(consumer => { + val topN = currentState.providerState.topNByConsumer.get(consumer) + val totalPowerConsu = currentState.consumerStates.get(consumer).chainState.currentValidatorPowers.mapValuesSum() + currentState.providerState.chainState.votingPowerHistory.toSet().exists( + valSet => { + val totalPowerProvi = valSet.mapValuesSum() + + totalPowerConsu >= totalPowerProvi * topN / 100 + } + ) + }) + + // SANITY CHECKS + + val CanOptIn = { + not( + trace[length(trace)-1].kind == "OptIn" + and + trace[length(trace)-1].expectedError == "" + ) + } + + val CanOptOut = { + not( + trace[length(trace)-1].kind == "OptOut" + and + trace[length(trace)-1].expectedError == "" + ) + } + + val CanFailOptOut = { + not( + trace[length(trace)-1].kind == "OptOut" + and + trace[length(trace)-1].expectedError != "" + ) + } + + val CanHaveOptIn = { + currentState.providerState.topNByConsumer.keys().exists(consumer => { + currentState.providerState.topNByConsumer.get(consumer) != 100 + }) + } +} \ No newline at end of file diff --git a/tests/mbt/model/ccv_pss_test.qnt b/tests/mbt/model/ccv_pss_test.qnt new file mode 100644 index 0000000000..61a5420150 --- /dev/null +++ b/tests/mbt/model/ccv_pss_test.qnt @@ -0,0 +1,61 @@ +// This module contains logic for PSS (Partial Set Security). +// PSS is a variant/extension of CCV that +// allows for only a subset of the validator set +// to secure a consumer chain. +// Not all logic related to PSS is inside this module, as some logic is +// too tightly coupled with the core CCV logic, +// which is instead found in ccv.qnt +module ccv_pss_test { + import ccv_types.* from "./ccv" + import extraSpells.* from "./libraries/extraSpells" + import ccv_utils.* from "./ccv_utils" + import ccv_pss.* from "./ccv_pss" + import ccv.* from "./ccv" + + run TopN1Test = + val valSet = + Map("d" -> 25, "c1" -> 15, "c" -> 15, "b2" -> 10, "b1" -> 10, "b" -> 10, "a2" -> 5, "a1" -> 5, "a" -> 5) + // total power: 5*3 + 10*3 + 15*2 + 25 = 100 + all + { + assert(GetTopNVals(valSet, 0) == Set()), + assert(GetTopNVals(valSet, 1) == Set("d")), + assert(GetTopNVals(valSet, 10) == Set("d")), + assert(GetTopNVals(valSet, 25) == Set("d")), + // if one validator with a power is included, all validators with that power need to be included + assert(GetTopNVals(valSet, 26) == Set("d", "c1", "c")), + assert(GetTopNVals(valSet, 45) == Set("d", "c1", "c")), + assert(GetTopNVals(valSet, 55) == Set("d", "c1", "c")), + assert(GetTopNVals(valSet, 56) == Set("d", "c1", "c", "b2", "b1", "b")), + assert(GetTopNVals(valSet, 85) == Set("d", "c1", "c", "b2", "b1", "b")), + assert(GetTopNVals(valSet, 86) == valSet.keys()), + assert(GetTopNVals(valSet, 95) == valSet.keys()), + assert(GetTopNVals(valSet, 100) == valSet.keys()), + } + + val providerState = GetEmptyProviderState().with( + "chainState", GetEmptyChainState().with( + "currentValidatorPowers", Map( + "a" -> 5, + "a1" -> 5, + "a2" -> 5, + "b" -> 10, + "b1" -> 10, + "b2" -> 10, + "c" -> 15, + "c1" -> 15, + "d" -> 25 + ) + ) + ).with( + "consumerStatus", Map( + "consumer1" -> "running" + ) + ).with( + "topNByConsumer", Map( + "consumer1" -> 80 + ) + ) + run TopN2Test = + true +} \ No newline at end of file diff --git a/tests/mbt/model/ccv_utils.qnt b/tests/mbt/model/ccv_utils.qnt index ffb22e0dda..6c0f18b44c 100644 --- a/tests/mbt/model/ccv_utils.qnt +++ b/tests/mbt/model/ccv_utils.qnt @@ -531,6 +531,11 @@ module ccv_utils { ) } + // Returns the set of all nodes that are neither jailed nor have 0 power on the provider. + pure def validatorsWithPower(providerState: ProviderState): Set[Node] = { + nonJailedNodes(providerState).filter(node => providerState.chainState.currentValidatorPowers.get(node) != 0) + } + pure def IsEmptyValSet(valSet: ValidatorSet): bool = { valSet.keys().filter( node => valSet.get(node) > 0 diff --git a/testutil/ibc_testing/generic_setup.go b/testutil/ibc_testing/generic_setup.go index 0df7174cbd..b74067afcc 100644 --- a/testutil/ibc_testing/generic_setup.go +++ b/testutil/ibc_testing/generic_setup.go @@ -7,6 +7,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" + testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -19,7 +20,6 @@ import ( testutil "github.com/cosmos/interchain-security/v5/testutil/integration" consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) type ( @@ -31,10 +31,16 @@ type ( // and/or democracy consumer app.go implementation. You should not need to modify or replicate this file // to run integration tests against your app.go implementations! +const ( + // Default number of consumer chains + NumConsumers = 5 +) + var ( FirstConsumerChainID string provChainID string democConsumerChainID string + consumerTopNParams [NumConsumers]uint32 ) func init() { @@ -43,6 +49,9 @@ func init() { FirstConsumerChainID = ibctesting.GetChainID(2) provChainID = ibctesting.GetChainID(1) democConsumerChainID = ibctesting.GetChainID(5000) + // TopN parameter values per consumer chain initiated + // sorted in ascending order i.e. testchain2, testchain3, ..., testchain6 + consumerTopNParams = [NumConsumers]uint32{100, 100, 100, 100, 100} } // ConsumerBundle serves as a way to store useful in-mem consumer app chain state @@ -52,6 +61,7 @@ type ConsumerBundle struct { App testutil.ConsumerApp Path *ibctesting.Path TransferPath *ibctesting.Path + TopN uint32 } // GetCtx returns the context for the ConsumerBundle @@ -117,6 +127,9 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( index int, appIniter ValSetAppIniter, ) *ConsumerBundle { + // check index isn't bigger that the number of consumers + s.Require().LessOrEqual(index, NumConsumers) + // consumer chain ID chainID := ibctesting.GetChainID(index + 2) @@ -125,30 +138,32 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( providerApp := providerChain.App.(Tp) providerKeeper := providerApp.GetProviderKeeper() - prop := providertypes.ConsumerAdditionProposal{ - Title: fmt.Sprintf("start chain %s", chainID), - Description: "description", - ChainId: chainID, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 2}, - GenesisHash: []byte("gen_hash"), - BinaryHash: []byte("bin_hash"), - // NOTE: we cannot use the time.Now() because the coordinator chooses a hardcoded start time - // using time.Now() could set the spawn time to be too far in the past or too far in the future - SpawnTime: coordinator.CurrentTime, - UnbondingPeriod: ccvtypes.DefaultConsumerUnbondingPeriod, - CcvTimeoutPeriod: ccvtypes.DefaultCCVTimeoutPeriod, - TransferTimeoutPeriod: ccvtypes.DefaultTransferTimeoutPeriod, - ConsumerRedistributionFraction: ccvtypes.DefaultConsumerRedistributeFrac, - BlocksPerDistributionTransmission: ccvtypes.DefaultBlocksPerDistributionTransmission, - HistoricalEntries: ccvtypes.DefaultHistoricalEntries, - DistributionTransmissionChannel: "", - } + prop := testkeeper.GetTestConsumerAdditionProp() + prop.ChainId = chainID + prop.Top_N = consumerTopNParams[index] // isn't used in CreateConsumerClient - providerKeeper.SetPendingConsumerAdditionProp(providerChain.GetContext(), &prop) + // NOTE: we cannot use the time.Now() because the coordinator chooses a hardcoded start time + // using time.Now() could set the spawn time to be too far in the past or too far in the future + prop.SpawnTime = coordinator.CurrentTime + // NOTE: the initial height passed to CreateConsumerClient + // must be the height on the consumer when InitGenesis is called + prop.InitialHeight = clienttypes.Height{RevisionNumber: 0, RevisionHeight: 2} + + providerKeeper.SetPendingConsumerAdditionProp(providerChain.GetContext(), prop) props := providerKeeper.GetAllPendingConsumerAdditionProps(providerChain.GetContext()) s.Require().Len(props, 1, "unexpected len consumer addition proposals in AddConsumer") + // opt-in all validators + lastVals, err := providerApp.GetTestStakingKeeper().GetLastValidators(providerChain.GetContext()) + s.Require().NoError(err) + + for _, v := range lastVals { + consAddr, _ := v.GetConsAddr() + providerKeeper.SetOptedIn(providerChain.GetContext(), chainID, providertypes.NewProviderConsAddress(consAddr)) + } + // commit the state on the provider chain + // and create the client and genesis of consumer coordinator.CommitBlock(providerChain) // get genesis state created by the provider @@ -188,5 +203,6 @@ func AddConsumer[Tp testutil.ProviderApp, Tc testutil.ConsumerApp]( return &ConsumerBundle{ Chain: testChain, App: consumerToReturn, + TopN: prop.Top_N, } } diff --git a/testutil/integration/debug_test.go b/testutil/integration/debug_test.go index af37fbb5a1..1a847c4011 100644 --- a/testutil/integration/debug_test.go +++ b/testutil/integration/debug_test.go @@ -304,3 +304,23 @@ func TestAfterPropSubmissionAndVotingPeriodEnded(t *testing.T) { func TestGetConsumerAdditionLegacyPropFromProp(t *testing.T) { runCCVTestByName(t, "TestGetConsumerAdditionLegacyPropFromProp") } + +func TestIBCTransferMiddleware(t *testing.T) { + runCCVTestByName(t, "TestIBCTransferMiddleware") +} + +func TestAllocateTokens(t *testing.T) { + runCCVTestByName(t, "TestAllocateTokens") +} + +func TestTransferConsumerRewardsToDistributionModule(t *testing.T) { + runCCVTestByName(t, "TransferConsumerRewardsToDistributionModule") +} + +func TestAllocateTokensToValidator(t *testing.T) { + runCCVTestByName(t, "TestAllocateTokensToValidator") +} + +func TestMultiConsumerRewardsDistribution(t *testing.T) { + runCCVTestByName(t, "TestMultiConsumerRewardsDistribution") +} diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index b36befe20f..4389c7698d 100644 --- a/testutil/integration/interfaces.go +++ b/testutil/integration/interfaces.go @@ -8,21 +8,22 @@ import ( "cosmossdk.io/core/comet" "cosmossdk.io/math" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + evidencekeeper "cosmossdk.io/x/evidence/keeper" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" - - evidencekeeper "cosmossdk.io/x/evidence/keeper" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" consumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) // The interface that any provider app must implement to be compatible with ccv integration tests. @@ -140,4 +141,17 @@ type TestDistributionKeeper interface { GetDistributionAccount(ctx context.Context) sdk.ModuleAccountI GetValidatorOutstandingRewards(ctx context.Context, val sdk.ValAddress) (rewards distributiontypes.ValidatorOutstandingRewards, err error) GetCommunityTax(ctx context.Context) (math.LegacyDec, error) + WithdrawValidatorCommission(ctx context.Context, valAddr sdk.ValAddress) (sdk.Coins, error) +} + +type TestMintKeeper interface { + GetParams(ctx sdk.Context) (params minttypes.Params) +} + +type TestGovKeeper interface { + GetParams(ctx sdk.Context) govv1.Params + SetParams(ctx sdk.Context, params govv1.Params) error + SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress) (govv1.Proposal, error) + AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error) + AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options govv1.WeightedVoteOptions, metadata string) error } diff --git a/testutil/keeper/expectations.go b/testutil/keeper/expectations.go index f6734d64f6..01b1c0c1af 100644 --- a/testutil/keeper/expectations.go +++ b/testutil/keeper/expectations.go @@ -54,11 +54,9 @@ func GetMocksForMakeConsumerGenesis(ctx sdk.Context, mocks *MockedKeepers, ) []*gomock.Call { return []*gomock.Call{ mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTimeToInject, nil).Times(1), - mocks.MockClientKeeper.EXPECT().GetSelfConsensusState(gomock.Any(), clienttypes.GetSelfHeight(ctx)).Return(&ibctmtypes.ConsensusState{}, nil).Times(1), - - mocks.MockStakingKeeper.EXPECT().IterateLastValidatorPowers(gomock.Any(), gomock.Any()).Times(1), + // mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(1), } } diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index f0cb00b07f..8e2c552c95 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -122,6 +122,21 @@ func (mr *MockStakingKeeperMockRecorder) GetLastValidators(ctx interface{}) *gom return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastValidators", reflect.TypeOf((*MockStakingKeeper)(nil).GetLastValidators), ctx) } +// GetRedelegationByUnbondingID mocks base method. +func (m *MockStakingKeeper) GetRedelegationByUnbondingID(ctx context.Context, id uint64) (types3.Redelegation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRedelegationByUnbondingID", ctx, id) + ret0, _ := ret[0].(types3.Redelegation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRedelegationByUnbondingID indicates an expected call of GetRedelegationByUnbondingID. +func (mr *MockStakingKeeperMockRecorder) GetRedelegationByUnbondingID(ctx, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRedelegationByUnbondingID", reflect.TypeOf((*MockStakingKeeper)(nil).GetRedelegationByUnbondingID), ctx, id) +} + // GetRedelegationsFromSrcValidator mocks base method. func (m *MockStakingKeeper) GetRedelegationsFromSrcValidator(ctx context.Context, valAddr types1.ValAddress) ([]types3.Redelegation, error) { m.ctrl.T.Helper() @@ -137,6 +152,21 @@ func (mr *MockStakingKeeperMockRecorder) GetRedelegationsFromSrcValidator(ctx, v return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRedelegationsFromSrcValidator", reflect.TypeOf((*MockStakingKeeper)(nil).GetRedelegationsFromSrcValidator), ctx, valAddr) } +// GetUnbondingDelegationByUnbondingID mocks base method. +func (m *MockStakingKeeper) GetUnbondingDelegationByUnbondingID(ctx context.Context, id uint64) (types3.UnbondingDelegation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUnbondingDelegationByUnbondingID", ctx, id) + ret0, _ := ret[0].(types3.UnbondingDelegation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUnbondingDelegationByUnbondingID indicates an expected call of GetUnbondingDelegationByUnbondingID. +func (mr *MockStakingKeeperMockRecorder) GetUnbondingDelegationByUnbondingID(ctx, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUnbondingDelegationByUnbondingID", reflect.TypeOf((*MockStakingKeeper)(nil).GetUnbondingDelegationByUnbondingID), ctx, id) +} + // GetUnbondingDelegationsFromValidator mocks base method. func (m *MockStakingKeeper) GetUnbondingDelegationsFromValidator(ctx context.Context, valAddr types1.ValAddress) ([]types3.UnbondingDelegation, error) { m.ctrl.T.Helper() @@ -197,6 +227,21 @@ func (mr *MockStakingKeeperMockRecorder) GetValidatorByConsAddr(ctx, consAddr in return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorByConsAddr", reflect.TypeOf((*MockStakingKeeper)(nil).GetValidatorByConsAddr), ctx, consAddr) } +// GetValidatorByUnbondingID mocks base method. +func (m *MockStakingKeeper) GetValidatorByUnbondingID(ctx context.Context, id uint64) (types3.Validator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetValidatorByUnbondingID", ctx, id) + ret0, _ := ret[0].(types3.Validator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidatorByUnbondingID indicates an expected call of GetValidatorByUnbondingID. +func (mr *MockStakingKeeperMockRecorder) GetValidatorByUnbondingID(ctx, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorByUnbondingID", reflect.TypeOf((*MockStakingKeeper)(nil).GetValidatorByUnbondingID), ctx, id) +} + // GetValidatorUpdates mocks base method. func (m *MockStakingKeeper) GetValidatorUpdates(ctx context.Context) ([]types0.ValidatorUpdate, error) { m.ctrl.T.Helper() @@ -284,6 +329,21 @@ func (mr *MockStakingKeeperMockRecorder) MaxValidators(ctx interface{}) *gomock. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MaxValidators", reflect.TypeOf((*MockStakingKeeper)(nil).MaxValidators), ctx) } +// MinCommissionRate mocks base method. +func (m *MockStakingKeeper) MinCommissionRate(ctx context.Context) (math.LegacyDec, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MinCommissionRate", ctx) + ret0, _ := ret[0].(math.LegacyDec) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// MinCommissionRate indicates an expected call of MinCommissionRate. +func (mr *MockStakingKeeperMockRecorder) MinCommissionRate(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MinCommissionRate", reflect.TypeOf((*MockStakingKeeper)(nil).MinCommissionRate), ctx) +} + // PowerReduction mocks base method. func (m *MockStakingKeeper) PowerReduction(ctx context.Context) math.Int { m.ctrl.T.Helper() @@ -918,6 +978,20 @@ func (m *MockDistributionKeeper) EXPECT() *MockDistributionKeeperMockRecorder { return m.recorder } +// AllocateTokensToValidator mocks base method. +func (m *MockDistributionKeeper) AllocateTokensToValidator(ctx context.Context, validator types3.ValidatorI, reward types1.DecCoins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AllocateTokensToValidator", ctx, validator, reward) + ret0, _ := ret[0].(error) + return ret0 +} + +// AllocateTokensToValidator indicates an expected call of AllocateTokensToValidator. +func (mr *MockDistributionKeeperMockRecorder) AllocateTokensToValidator(ctx, validator, reward interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AllocateTokensToValidator", reflect.TypeOf((*MockDistributionKeeper)(nil).AllocateTokensToValidator), ctx, validator, reward) +} + // FundCommunityPool mocks base method. func (m *MockDistributionKeeper) FundCommunityPool(ctx context.Context, amount types1.Coins, sender types1.AccAddress) error { m.ctrl.T.Helper() @@ -932,6 +1006,21 @@ func (mr *MockDistributionKeeperMockRecorder) FundCommunityPool(ctx, amount, sen return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FundCommunityPool", reflect.TypeOf((*MockDistributionKeeper)(nil).FundCommunityPool), ctx, amount, sender) } +// GetCommunityTax mocks base method. +func (m *MockDistributionKeeper) GetCommunityTax(ctx context.Context) (math.LegacyDec, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCommunityTax", ctx) + ret0, _ := ret[0].(math.LegacyDec) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCommunityTax indicates an expected call of GetCommunityTax. +func (mr *MockDistributionKeeperMockRecorder) GetCommunityTax(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCommunityTax", reflect.TypeOf((*MockDistributionKeeper)(nil).GetCommunityTax), ctx) +} + // MockConsumerHooks is a mock of ConsumerHooks interface. type MockConsumerHooks struct { ctrl *gomock.Controller diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index af31cd973c..d90226b630 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -227,6 +227,7 @@ func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context, providerKeeper *providerkeeper.Keeper, mocks MockedKeepers, ) { t.Helper() + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(1) expectations := GetMocksForCreateConsumerClient(ctx, &mocks, "chainID", clienttypes.NewHeight(4, 5)) expectations = append(expectations, GetMocksForSetConsumerChain(ctx, &mocks, "chainID")...) @@ -261,10 +262,15 @@ func TestProviderStateIsCleanedAfterConsumerChainIsStopped(t *testing.T, ctx sdk require.Empty(t, providerKeeper.GetAllVscSendTimestamps(ctx, expectedChainID)) + // in case the chain was successfully stopped, it should not contain a Top N associated to it + _, found = providerKeeper.GetTopN(ctx, expectedChainID) + require.False(t, found) + // test key assignment state is cleaned require.Empty(t, providerKeeper.GetAllValidatorConsumerPubKeys(ctx, &expectedChainID)) require.Empty(t, providerKeeper.GetAllValidatorsByConsumerAddr(ctx, &expectedChainID)) require.Empty(t, providerKeeper.GetAllConsumerAddrsToPrune(ctx, expectedChainID)) + require.Empty(t, providerKeeper.GetAllCommissionRateValidators(ctx, expectedChainID)) } func GetTestConsumerAdditionProp() *providertypes.ConsumerAdditionProposal { @@ -283,6 +289,11 @@ func GetTestConsumerAdditionProp() *providertypes.ConsumerAdditionProposal { types.DefaultCCVTimeoutPeriod, types.DefaultTransferTimeoutPeriod, types.DefaultConsumerUnbondingPeriod, + 0, + 0, + 0, + nil, + nil, ).(*providertypes.ConsumerAdditionProposal) return prop diff --git a/x/ccv/consumer/keeper/soft_opt_out.go b/x/ccv/consumer/keeper/soft_opt_out.go index 1de2345cbc..39b5bc22bc 100644 --- a/x/ccv/consumer/keeper/soft_opt_out.go +++ b/x/ccv/consumer/keeper/soft_opt_out.go @@ -59,13 +59,13 @@ func (k Keeper) UpdateSmallestNonOptOutPower(ctx sdk.Context) { // get total power in set totalPower := math.LegacyZeroDec() for _, val := range valset { - totalPower = totalPower.Add(math.LegacyNewDecFromInt(math.NewInt(val.Power))) + totalPower = totalPower.Add(math.LegacyNewDec(val.Power)) } // get power of the smallest validator that cannot soft opt out powerSum := math.LegacyZeroDec() for _, val := range valset { - powerSum = powerSum.Add(math.LegacyNewDecFromInt(math.NewInt(val.Power))) + powerSum = powerSum.Add(math.LegacyNewDec(val.Power)) // if powerSum / totalPower > SoftOptOutThreshold if powerSum.Quo(totalPower).GT(optOutThreshold) { // set smallest non opt out power diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index b3494ac884..697fccbb76 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -35,6 +35,10 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand(CmdProposedConsumerChains()) cmd.AddCommand(CmdAllPairsValConAddrByConsumerChainID()) cmd.AddCommand(CmdProviderParameters()) + cmd.AddCommand(CmdConsumerChainOptedInValidators()) + cmd.AddCommand(CmdConsumerValidators()) + cmd.AddCommand(CmdConsumerChainsValidatorHasToValidate()) + cmd.AddCommand(CmdValidatorConsumerCommissionRate()) cmd.AddCommand(CmdOldestUnconfirmedVsc()) return cmd } @@ -352,7 +356,7 @@ $ %s query provider registered-consumer-reward-denoms func CmdAllPairsValConAddrByConsumerChainID() *cobra.Command { cmd := &cobra.Command{ - Use: "all-pairs-valconsensus-address", + Use: "all-pairs-valconsensus-address [consumer-chain-id]", Short: "Query all pairs of valconsensus address by consumer chainId.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -411,6 +415,161 @@ $ %s query provider params return cmd } +// Command to query opted-in validators by consumer chain ID +func CmdConsumerChainOptedInValidators() *cobra.Command { + cmd := &cobra.Command{ + Use: "consumer-opted-in-validators [chainid]", + Short: "Query opted-in validators for a given consumer chain", + Long: strings.TrimSpace( + fmt.Sprintf(`Query opted-in validators for a given consumer chain. +Example: +$ %s consumer-opted-in-validators foochain + `, version.AppName), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.QueryConsumerChainOptedInValidators(cmd.Context(), + &types.QueryConsumerChainOptedInValidatorsRequest{ChainId: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// Command to query the consumer validators by consumer chain ID +func CmdConsumerValidators() *cobra.Command { + cmd := &cobra.Command{ + Use: "consumer-validators [chainid]", + Short: "Query the last set consumer-validator set for a given consumer chain", + Long: strings.TrimSpace( + fmt.Sprintf(`Query the last set consumer-validator set for a given consumer chain. +Note that this does not necessarily mean that the consumer chain is currently using this validator set because a VSCPacket could be delayed, etc. +Example: +$ %s consumer-validators foochain + `, version.AppName), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.QueryConsumerValidators(cmd.Context(), + &types.QueryConsumerValidatorsRequest{ChainId: args[0]}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// Command to query the consumer chains list a given validator has to validate +func CmdConsumerChainsValidatorHasToValidate() *cobra.Command { + bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() + cmd := &cobra.Command{ + Use: "has-to-validate [provider-validator-address]", + Short: "Query the consumer chains list a given validator has to validate", + Long: strings.TrimSpace( + fmt.Sprintf(`the list of consumer chains that as a validator, you need to be running right now, is always a subset of this, so it seems like a very nice "safe bet". +Example: +$ %s has-to-validate %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj + `, version.AppName, bech32PrefixConsAddr), + ), + 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) + + addr, err := sdk.ConsAddressFromBech32(args[0]) + if err != nil { + return err + } + + res, err := queryClient.QueryConsumerChainsValidatorHasToValidate(cmd.Context(), + &types.QueryConsumerChainsValidatorHasToValidateRequest{ + ProviderAddress: addr.String(), + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// Command to query the consumer commission rate a validator charges +// on a consumer chain +func CmdValidatorConsumerCommissionRate() *cobra.Command { + bech32PrefixConsAddr := sdk.GetConfig().GetBech32ConsensusAddrPrefix() + cmd := &cobra.Command{ + Use: "validator-consumer-commission-rate [chainid] [provider-validator-address]", + Short: "Query the consumer commission rate a validator charges on a consumer chain", + Long: strings.TrimSpace( + fmt.Sprintf(`Query the consumer commission rate a validator charges on a consumer chain. +Example: +$ %s validator-consumer-commission-rate foochain %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj + `, version.AppName, bech32PrefixConsAddr), + ), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + addr, err := sdk.ConsAddressFromBech32(args[1]) + if err != nil { + return err + } + + res, err := queryClient.QueryValidatorConsumerCommissionRate(cmd.Context(), + &types.QueryValidatorConsumerCommissionRateRequest{ + ChainId: args[0], + ProviderAddress: addr.String(), + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + func CmdOldestUnconfirmedVsc() *cobra.Command { cmd := &cobra.Command{ Use: "oldest_unconfirmed_vsc [chainid]", diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index 536145267b..1b5913b096 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -6,6 +6,8 @@ import ( "os" "strings" + "cosmossdk.io/math" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/spf13/cobra" @@ -34,6 +36,9 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(NewAssignConsumerKeyCmd()) cmd.AddCommand(NewSubmitConsumerMisbehaviourCmd()) cmd.AddCommand(NewSubmitConsumerDoubleVotingCmd()) + cmd.AddCommand(NewOptInCmd()) + cmd.AddCommand(NewOptOutCmd()) + cmd.AddCommand(NewSetConsumerCommissionRateCmd()) return cmd } @@ -203,3 +208,132 @@ Example: return cmd } + +func NewOptInCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "opt-in [consumer-chain-id] [consumer-pubkey]", + Short: "opts in validator to the consumer chain, and if given uses the " + + "provided consensus public key for this consumer chain", + Args: cobra.RangeArgs(1, 2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + providerValAddr := clientCtx.GetFromAddress() + + var consumerPubKey string + if len(args) == 2 { + // consumer public key was provided + consumerPubKey = args[1] + } else { + consumerPubKey = "" + } + msg, err := types.NewMsgOptIn(args[0], sdk.ValAddress(providerValAddr), consumerPubKey) + if err != nil { + return err + } + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} + +func NewOptOutCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "opt-out [consumer-chain-id]", + Short: "opts out validator from this consumer chain", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + providerValAddr := clientCtx.GetFromAddress() + + msg, err := types.NewMsgOptOut(args[0], sdk.ValAddress(providerValAddr)) + if err != nil { + return err + } + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} + +func NewSetConsumerCommissionRateCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-consumer-commission-rate [consumer-chain-id] [commission-rate]", + Short: "set a per-consumer chain commission", + Long: strings.TrimSpace( + fmt.Sprintf(`Note that the "commission-rate" argument is a fraction and should be in the range [0,1]. + Example: + %s set-consumer-commission-rate consumer-1 0.5 --from node0 --home ../node0`, + version.AppName), + ), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + providerValAddr := clientCtx.GetFromAddress() + + commission, err := math.LegacyNewDecFromStr(args[1]) + if err != nil { + return err + } + msg := types.NewMsgSetConsumerCommissionRate(args[0], commission, sdk.ValAddress(providerValAddr)) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} diff --git a/x/ccv/provider/client/legacy_proposal_handler.go b/x/ccv/provider/client/legacy_proposal_handler.go index 7ac9198be2..f837e7bab2 100644 --- a/x/ccv/provider/client/legacy_proposal_handler.go +++ b/x/ccv/provider/client/legacy_proposal_handler.go @@ -15,9 +15,10 @@ import ( ) var ( - ConsumerAdditionProposalHandler = govclient.NewProposalHandler(SubmitConsumerAdditionPropTxCmd) - ConsumerRemovalProposalHandler = govclient.NewProposalHandler(SubmitConsumerRemovalProposalTxCmd) - ChangeRewardDenomsProposalHandler = govclient.NewProposalHandler(SubmitChangeRewardDenomsProposalTxCmd) + ConsumerAdditionProposalHandler = govclient.NewProposalHandler(SubmitConsumerAdditionPropTxCmd) + ConsumerRemovalProposalHandler = govclient.NewProposalHandler(SubmitConsumerRemovalProposalTxCmd) + ChangeRewardDenomsProposalHandler = govclient.NewProposalHandler(SubmitChangeRewardDenomsProposalTxCmd) + ConsumerModificationProposalHandler = govclient.NewProposalHandler(SubmitConsumerModificationProposalTxCmd) ) // SubmitConsumerAdditionPropTxCmd returns a CLI command handler for submitting @@ -55,7 +56,12 @@ Where proposal.json contains: "transfer_timeout_period": 3600000000000, "ccv_timeout_period": 2419200000000000, "unbonding_period": 1728000000000000, - "deposit": "10000stake" + "deposit": "10000stake", + "top_n": 0, + "validators_power_cap": 32, + "validator_set_cap": 50, + "allowlist": [], + "denylist": ["validatorAConsensusAddress", "validatorBConsensusAddress"] } `, RunE: func(cmd *cobra.Command, args []string) error { @@ -77,7 +83,8 @@ Where proposal.json contains: proposal.GenesisHash, proposal.BinaryHash, proposal.SpawnTime, proposal.ConsumerRedistributionFraction, proposal.BlocksPerDistributionTransmission, proposal.DistributionTransmissionChannel, proposal.HistoricalEntries, - proposal.CcvTimeoutPeriod, proposal.TransferTimeoutPeriod, proposal.UnbondingPeriod) + proposal.CcvTimeoutPeriod, proposal.TransferTimeoutPeriod, proposal.UnbondingPeriod, proposal.TopN, + proposal.ValidatorsPowerCap, proposal.ValidatorSetCap, proposal.Allowlist, proposal.Denylist) from := clientCtx.GetFromAddress() @@ -213,3 +220,67 @@ func SubmitChangeRewardDenomsProposalTxCmd() *cobra.Command { }, } } + +// SubmitConsumerModificationProposalTxCmd returns a CLI command handler for submitting +// a consumer modification proposal via a transaction. +func SubmitConsumerModificationProposalTxCmd() *cobra.Command { + return &cobra.Command{ + Use: "consumer-modification [proposal-file]", + Args: cobra.ExactArgs(1), + Short: "Submit a consumer modification proposal", + Long: ` +Submit a consumer modification proposal along with an initial deposit. +The proposal details must be supplied via a JSON file. + +Example: +$ tx gov submit-legacy-proposal consumer-modification --from= + +Where proposal.json contains: + +{ + "title": "Modify FooChain", + "summary": "Make it an Opt In chain", + "chain_id": "foochain", + "top_n": 0, + "validators_power_cap": 32, + "validator_set_cap": 50, + "allowlist": [], + "denylist": ["validatorAConsensusAddress", "validatorBConsensusAddress"] +} + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + proposal, err := ParseConsumerModificationProposalJSON(args[0]) + if err != nil { + return err + } + + content := types.NewConsumerModificationProposal( + proposal.Title, proposal.Summary, proposal.ChainId, proposal.TopN, + proposal.ValidatorsPowerCap, proposal.ValidatorSetCap, proposal.Allowlist, proposal.Denylist) + + from := clientCtx.GetFromAddress() + + deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) + if err != nil { + return err + } + + msgContent, err := govv1.NewLegacyContent(content, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + if err != nil { + return err + } + + msg, err := govv1.NewMsgSubmitProposal([]sdk.Msg{msgContent}, deposit, from.String(), "", content.GetTitle(), proposal.Summary, false) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } +} diff --git a/x/ccv/provider/client/legacy_proposals.go b/x/ccv/provider/client/legacy_proposals.go index 9493c0d8c6..b19528b1b7 100644 --- a/x/ccv/provider/client/legacy_proposals.go +++ b/x/ccv/provider/client/legacy_proposals.go @@ -35,6 +35,12 @@ type ConsumerAdditionProposalJSON struct { UnbondingPeriod time.Duration `json:"unbonding_period"` Deposit string `json:"deposit"` + + TopN uint32 `json:"top_N"` + ValidatorsPowerCap uint32 `json:"validators_power_cap"` + ValidatorSetCap uint32 `json:"validator_set_cap"` + Allowlist []string `json:"allowlist"` + Denylist []string `json:"denylist"` } type ConsumerAdditionProposalReq struct { @@ -145,7 +151,8 @@ func CheckPropUnbondingPeriod(clientCtx client.Context, propUnbondingPeriod time providerUnbondingTime := res.Params.UnbondingTime if providerUnbondingTime < propUnbondingPeriod { - fmt.Printf( + fmt.Fprintf( + os.Stderr, `consumer unbonding period is advised to be smaller than provider unbonding period, but is longer. This is not a security risk, but will effectively lengthen the unbonding period on the provider. consumer unbonding: %s @@ -154,3 +161,32 @@ provider unbonding: %s`, providerUnbondingTime) } } + +type ConsumerModificationProposalJSON struct { + Title string `json:"title"` + Summary string `json:"summary"` + ChainId string `json:"chain_id"` + + TopN uint32 `json:"top_N"` + ValidatorsPowerCap uint32 `json:"validators_power_cap"` + ValidatorSetCap uint32 `json:"validator_set_cap"` + Allowlist []string `json:"allowlist"` + Denylist []string `json:"denylist"` + + Deposit string `json:"deposit"` +} + +func ParseConsumerModificationProposalJSON(proposalFile string) (ConsumerModificationProposalJSON, error) { + proposal := ConsumerModificationProposalJSON{} + + contents, err := os.ReadFile(filepath.Clean(proposalFile)) + if err != nil { + return proposal, err + } + + if err := json.Unmarshal(contents, &proposal); err != nil { + return proposal, err + } + + return proposal, nil +} diff --git a/x/ccv/provider/handler.go b/x/ccv/provider/handler.go index 2c2738ce91..7e8e0019cb 100644 --- a/x/ccv/provider/handler.go +++ b/x/ccv/provider/handler.go @@ -27,6 +27,15 @@ func NewHandler(k *keeper.Keeper) baseapp.MsgServiceHandler { case *types.MsgSubmitConsumerDoubleVoting: res, err := msgServer.SubmitConsumerDoubleVoting(ctx, msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgOptIn: + res, err := msgServer.OptIn(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgOptOut: + res, err := msgServer.OptOut(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgSetConsumerCommissionRate: + res, err := msgServer.SetConsumerCommissionRate(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } diff --git a/x/ccv/provider/handler_test.go b/x/ccv/provider/handler_test.go index 11fb18bf1f..ffb3614e17 100644 --- a/x/ccv/provider/handler_test.go +++ b/x/ccv/provider/handler_test.go @@ -34,6 +34,10 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { providerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(0) providerConsAddr := providerCryptoId.ProviderConsAddress() + // a different providerConsAddr, to simulate different validators having assigned keys + providerCryptoId2 := testcrypto.NewCryptoIdentityFromIntSeed(10) + providerConsAddr2 := providerCryptoId2.ProviderConsAddress() + consumerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(1) consumerConsAddr := consumerCryptoId.ConsumerConsAddress() consumerKeyBz := base64.StdEncoding.EncodeToString(consumerCryptoId.ConsensusSDKPubKey().Bytes()) @@ -99,7 +103,32 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { chainID: "chainid", }, { - name: "fail: consumer key in use", + name: "fail: consumer key in use by other validator", + setup: func(ctx sdk.Context, + k keeper.Keeper, mocks testkeeper.MockedKeepers, + ) { + k.SetPendingConsumerAdditionProp(ctx, &providertypes.ConsumerAdditionProposal{ + ChainId: "chainid", + }) + // Use the consumer key already used by some other validator + k.SetValidatorByConsumerAddr(ctx, "chainid", consumerConsAddr, providerConsAddr2) + + gomock.InOrder( + mocks.MockStakingKeeper.EXPECT().GetValidator( + ctx, providerCryptoId.SDKValOpAddress(), + // validator should not be missing + ).Return(providerCryptoId.SDKStakingValidator(), nil).Times(1), + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, + consumerConsAddr.ToSdkConsAddr(), + // return false - no other validator uses the consumer key to validate *on the provider* + ).Return(stakingtypes.Validator{}, nil), + ) + }, + expError: true, + chainID: "chainid", + }, + { + name: "success: consumer key in use, but by the same validator", setup: func(ctx sdk.Context, k keeper.Keeper, mocks testkeeper.MockedKeepers, ) { @@ -118,7 +147,7 @@ func TestAssignConsensusKeyMsgHandling(t *testing.T) { ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound), ) }, - expError: true, + expError: false, chainID: "chainid", }, } diff --git a/x/ccv/provider/ibc_middleware.go b/x/ccv/provider/ibc_middleware.go new file mode 100644 index 0000000000..f4128260e1 --- /dev/null +++ b/x/ccv/provider/ibc_middleware.go @@ -0,0 +1,242 @@ +package provider + +import ( + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + + "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +var _ porttypes.Middleware = &IBCMiddleware{} + +// IBCMiddleware implements the callbacks for the IBC transfer middleware given the +// provider keeper and the underlying application. +type IBCMiddleware struct { + app porttypes.IBCModule + keeper keeper.Keeper +} + +// NewIBCMiddleware creates a new IBCMiddlware given the keeper and underlying application +func NewIBCMiddleware(app porttypes.IBCModule, k keeper.Keeper) IBCMiddleware { + return IBCMiddleware{ + app: app, + keeper: k, + } +} + +// OnChanOpenInit implements the IBCMiddleware interface +func (im IBCMiddleware) OnChanOpenInit( + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID string, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + version string, +) (string, error) { + // call underlying app's OnChanOpenInit callback with the appVersion + return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version) +} + +// OnChanOpenTry implements the IBCMiddleware interface +func (im IBCMiddleware) OnChanOpenTry( + ctx sdk.Context, + order channeltypes.Order, + connectionHops []string, + portID, + channelID string, + chanCap *capabilitytypes.Capability, + counterparty channeltypes.Counterparty, + counterpartyVersion string, +) (string, error) { + // call underlying app's OnChanOpenTry callback with the appVersion + return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) +} + +// OnChanOpenAck implements the IBCMiddleware interface +func (im IBCMiddleware) OnChanOpenAck( + ctx sdk.Context, + portID, + channelID string, + counterpartyChannelID string, + counterpartyVersion string, +) error { + // call underlying app's OnChanOpenAck callback with the counterparty app version. + return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) +} + +// OnChanOpenConfirm implements the IBCMiddleware interface +func (im IBCMiddleware) OnChanOpenConfirm( + ctx sdk.Context, + portID, + channelID string, +) error { + // call underlying app's OnChanOpenConfirm callback. + return im.app.OnChanOpenConfirm(ctx, portID, channelID) +} + +// OnChanCloseInit implements the IBCMiddleware interface +func (im IBCMiddleware) OnChanCloseInit( + ctx sdk.Context, + portID, + channelID string, +) error { + // call underlying app's OnChanCloseInit callback. + return im.app.OnChanCloseInit(ctx, portID, channelID) +} + +// OnChanCloseConfirm implements the IBCMiddleware interface +func (im IBCMiddleware) OnChanCloseConfirm( + ctx sdk.Context, + portID, + channelID string, +) error { + return im.app.OnChanCloseConfirm(ctx, portID, channelID) +} + +// OnRecvPacket executes the IBC transfer. In case of success, +// it verifies if the packet sender is a consumer chain +// and if the received IBC coin is whitelisted. In such instances, +// it appends the coin to the consumer's chain allocation record +func (im IBCMiddleware) OnRecvPacket( + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, +) exported.Acknowledgement { + // executes the IBC transfer OnRecv logic + ack := im.app.OnRecvPacket(ctx, packet, relayer) + + // Note that inside the below if condition statement, + // we know that the IBC transfer succeeded. That entails + // that the packet data is valid and can be safely + // deserialized without checking errors. + if ack.Success() { + // execute the middleware logic only if the sender is a consumer chain + consumerID, err := im.keeper.IdentifyConsumerChainIDFromIBCPacket(ctx, packet) + if err != nil { + return ack + } + + // extract the coin info received from the packet data + var data ibctransfertypes.FungibleTokenPacketData + _ = types.ModuleCdc.UnmarshalJSON(packet.GetData(), &data) + + // check if the recipient is the consumer reward's pool address + receiver, _ := sdk.AccAddressFromBech32(data.Receiver) + if receiver.String() != im.keeper.GetConsumerRewardsPoolAddressStr(ctx) { + return ack + } + + coinAmt, _ := math.NewIntFromString(data.Amount) + coinDenom := GetProviderDenom(data.Denom, packet) + + // verify that the coin's denom is a whitelisted consumer denom, + // and if so, adds it to the consumer chain rewards allocation, + // otherwise the prohibited coin just stays in the pool forever. + if im.keeper.ConsumerRewardDenomExists(ctx, coinDenom) { + alloc := im.keeper.GetConsumerRewardsAllocation(ctx, consumerID) + alloc.Rewards = alloc.Rewards.Add( + sdk.NewDecCoinsFromCoins(sdk.Coin{ + Denom: coinDenom, + Amount: coinAmt, + })...) + im.keeper.SetConsumerRewardsAllocation(ctx, consumerID, alloc) + } + } + + return ack +} + +// OnAcknowledgementPacket implements the IBCMiddleware interface +// If fees are not enabled, this callback will default to the ibc-core packet callback +func (im IBCMiddleware) OnAcknowledgementPacket( + ctx sdk.Context, + packet channeltypes.Packet, + acknowledgement []byte, + relayer sdk.AccAddress, +) error { + // call underlying app's OnAcknowledgementPacket callback. + return im.app.OnAcknowledgementPacket(ctx, packet, acknowledgement, relayer) +} + +// OnTimeoutPacket implements the IBCMiddleware interface +// If fees are not enabled, this callback will default to the ibc-core packet callback +func (im IBCMiddleware) OnTimeoutPacket( + ctx sdk.Context, + packet channeltypes.Packet, + relayer sdk.AccAddress, +) error { + // call underlying app's OnTimeoutPacket callback. + return im.app.OnTimeoutPacket(ctx, packet, relayer) +} + +// SendPacket implements the ICS4 Wrapper interface +func (im IBCMiddleware) SendPacket( + sdk.Context, + *capabilitytypes.Capability, + string, + string, + clienttypes.Height, + uint64, + []byte, +) (uint64, error) { + panic("should never be called since the IBC middleware doesn't have an ICS4wrapper") +} + +// WriteAcknowledgement implements the ICS4 Wrapper interface +func (im IBCMiddleware) WriteAcknowledgement( + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + packet exported.PacketI, + ack exported.Acknowledgement, +) error { + panic("should never be called since the IBC middleware doesn't have an ICS4wrapper") +} + +// GetAppVersion returns the application version of the underlying application +func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { + panic("should never be called since the IBC middleware doesn't have an ICS4wrapper") +} + +// GetProviderDenom returns the updated given denom according to the given IBC packet +// It follows the same logic than the OnRecvPacket method of the IBC transfer module +// see https://github.com/cosmos/ibc-go/blob/v7.3.2/modules/apps/transfer/keeper/relay.go#L162 +func GetProviderDenom(denom string, packet channeltypes.Packet) (providerDenom string) { + // If the the prefix denom corresponds to the packet's source port and channel, + // returns the base denom + if ibctransfertypes.ReceiverChainIsSource(packet.GetSourcePort(), packet.GetSourceChannel(), denom) { + voucherPrefix := ibctransfertypes.GetDenomPrefix(packet.GetSourcePort(), packet.GetSourceChannel()) + unprefixedDenom := denom[len(voucherPrefix):] + + // coin denomination used in sending from the escrow address + providerDenom = unprefixedDenom + + // The denomination used to send the coins is either the native denom or the hash of the path + // if the denomination is not native. + denomTrace := ibctransfertypes.ParseDenomTrace(unprefixedDenom) + if denomTrace.Path != "" { + providerDenom = denomTrace.IBCDenom() + } + // update the prefix denom according to the packet info + } else { + prefixedDenom := ibctransfertypes.GetPrefixedDenom( + packet.GetDestPort(), + packet.GetDestChannel(), + denom, + ) + + providerDenom = ibctransfertypes.ParseDenomTrace(prefixedDenom).IBCDenom() + } + + return providerDenom +} diff --git a/x/ccv/provider/ibc_middleware_test.go b/x/ccv/provider/ibc_middleware_test.go new file mode 100644 index 0000000000..3148069bf2 --- /dev/null +++ b/x/ccv/provider/ibc_middleware_test.go @@ -0,0 +1,77 @@ +package provider_test + +import ( + "testing" + + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + "github.com/stretchr/testify/require" + + "github.com/cosmos/interchain-security/v5/x/ccv/provider" +) + +func TestGetProviderDenom(t *testing.T) { + testCases := []struct { + name string + denom string + packet channeltypes.Packet + expProviderDenom string + }{ + { + name: "returns base denom with destination port and channel as prefix", + denom: "stake", + packet: channeltypes.NewPacket( + []byte{}, + 0, + "srcPort", + "srcChannel", + "dstPort", + "dstChannel", + clienttypes.NewHeight(1, 1), + 0, + ), + expProviderDenom: "dstPort/dstChannel/stake", + }, + { + name: "returns base denom if the prefix denom corresponds to the packet's port and channel source", + denom: "srcPort/srcChannel/stake", + packet: channeltypes.NewPacket( + []byte{}, + 0, + "srcPort", + "srcChannel", + "dstPort", + "dstChannel", + clienttypes.NewHeight(1, 1), + 0, + ), + expProviderDenom: "stake", + }, + { + name: "returns prefixed denom updated with packet's port and channel destination as prefix", + denom: "dstPort/dstChannel/stake", + packet: channeltypes.NewPacket( + []byte{}, + 0, + "srcPort", + "srcChannel", + "dstPort", + "dstChannel", + clienttypes.NewHeight(1, 1), + 0, + ), + expProviderDenom: "dstPort/dstChannel/dstPort/dstChannel/stake", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + res := provider.GetProviderDenom( + tc.denom, + tc.packet, + ) + + require.Equal(t, tc.expProviderDenom, res) + }) + } +} diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 0b2cdcf0e9..86bcde5986 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -2,17 +2,26 @@ package keeper import ( storetypes "cosmossdk.io/store/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + + "context" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ) -// EndBlockRD executes EndBlock logic for the Reward Distribution sub-protocol. -// Reward Distribution follows a simple model: send tokens to the ConsumerRewardsPool, -// from where they sent to the fee collector address -func (k Keeper) EndBlockRD(ctx sdk.Context) { - // transfers all whitelisted consumer rewards to the fee collector address - k.TransferRewardsToFeeCollector(ctx) +// BeginBlockRD executes BeginBlock logic for the Reward Distribution sub-protocol. +func (k Keeper) BeginBlockRD(ctx sdk.Context) { + // TODO this is Tendermint-dependent + // ref https://github.com/cosmos/cosmos-sdk/issues/3095 + if ctx.BlockHeight() > 1 { + k.AllocateTokens(ctx) + } } func (k Keeper) GetConsumerRewardsPoolAddressStr(ctx sdk.Context) string { @@ -57,32 +66,245 @@ func (k Keeper) GetAllConsumerRewardDenoms(ctx sdk.Context) (consumerRewardDenom return consumerRewardDenoms } -// TransferRewardsToFeeCollector transfers all consumer rewards to the fee collector address -func (k Keeper) TransferRewardsToFeeCollector(ctx sdk.Context) { - // 1. Get the denom whitelist from the store - denoms := k.GetAllConsumerRewardDenoms(ctx) +// AllocateTokens performs rewards distribution to the community pool and validators +// based on the Partial Set Security distribution specification. +func (k Keeper) AllocateTokens(ctx sdk.Context) { + // return if there is no coins in the consumer rewards pool + if k.GetConsumerRewardsPool(ctx).IsZero() { + return + } + + // Iterate over all registered consumer chains + for _, consumer := range k.GetAllConsumerChains(ctx) { + // transfer the consumer rewards to the distribution module account + // note that the rewards transferred are only consumer whitelisted denoms + rewardsCollected, err := k.TransferConsumerRewardsToDistributionModule(ctx, consumer.ChainId) + if err != nil { + k.Logger(ctx).Error( + "fail to transfer rewards to distribution module for chain %s: %s", + consumer.ChainId, + err, + ) + continue + } + + // note that it's possible that no rewards are collected even though the + // reward pool isn't empty. This can happen if the reward pool holds some tokens + // of non-whitelisted denominations. + if rewardsCollected.IsZero() { + continue + } + + // temporary workaround to keep CanWithdrawInvariant happy + // general discussions here: https://github.com/cosmos/cosmos-sdk/issues/2906#issuecomment-441867634 + if k.ComputeConsumerTotalVotingPower(ctx, consumer.ChainId) == 0 { + k.distributionKeeper.FundCommunityPool(context.Context(ctx), rewardsCollected, k.accountKeeper.GetModuleAccount(ctx, types.ConsumerRewardsPool).GetAddress()) + return + } + + // calculate the reward allocations + rewardsCollectedDec := sdk.NewDecCoinsFromCoins(rewardsCollected...) + remaining := rewardsCollectedDec + communityTax, err := k.distributionKeeper.GetCommunityTax(ctx) + if err != nil { + k.Logger(ctx).Error( + "cannot get community tax while allocating rewards from consumer chain %s: %s", + consumer.ChainId, + err, + ) + continue + } + voteMultiplier := math.LegacyOneDec().Sub(communityTax) + feeMultiplier := rewardsCollectedDec.MulDecTruncate(voteMultiplier) - // 2. Iterate over the whitelist - for _, denom := range denoms { - // 3. For each denom, retrieve the balance from the consumer rewards pool - balance := k.bankKeeper.GetBalance( + // allocate tokens to consumer validators + feeAllocated := k.AllocateTokensToConsumerValidators( ctx, - k.accountKeeper.GetModuleAccount(ctx, types.ConsumerRewardsPool).GetAddress(), - denom, + consumer.ChainId, + feeMultiplier, ) + remaining = remaining.Sub(feeAllocated) - // if the balance is not zero, - if !balance.IsZero() { - // 4. Transfer the balance to the fee collector address - err := k.bankKeeper.SendCoinsFromModuleToModule( - ctx, - types.ConsumerRewardsPool, - k.feeCollectorName, - sdk.NewCoins(balance), - ) - if err != nil { - k.Logger(ctx).Error("cannot sent consumer rewards to fee collector:", "reward", balance.String()) - } + // allocate community funding + remainingCoins, _ := remaining.TruncateDecimal() + k.distributionKeeper.FundCommunityPool(context.Context(ctx), remainingCoins, k.accountKeeper.GetModuleAccount(ctx, types.ConsumerRewardsPool).GetAddress()) + } +} + +// AllocateTokensToConsumerValidators allocates tokens +// to the given consumer chain's validator set +func (k Keeper) AllocateTokensToConsumerValidators( + ctx sdk.Context, + chainID string, + tokens sdk.DecCoins, +) (allocated sdk.DecCoins) { + // return early if the tokens are empty + if tokens.Empty() { + return allocated + } + + // get the total voting power of the consumer valset + totalPower := math.LegacyNewDec(k.ComputeConsumerTotalVotingPower(ctx, chainID)) + if totalPower.IsZero() { + return allocated + } + + // Allocate tokens by iterating over the consumer validators + for _, consumerVal := range k.GetConsumerValSet(ctx, chainID) { + consAddr := sdk.ConsAddress(consumerVal.ProviderConsAddr) + + // get the validator tokens fraction using its voting power + powerFraction := math.LegacyNewDec(consumerVal.Power).QuoTruncate(totalPower) + tokensFraction := tokens.MulDecTruncate(powerFraction) + + // get the validator type struct for the consensus address + val, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr) + if err != nil { + k.Logger(ctx).Error("cannot find validator by consensus address :%s while allocating rewards from consumer chain: %s", + consAddr, chainID) + continue + } + + // check if the validator set a custom commission rate for the consumer chain + if cr, found := k.GetConsumerCommissionRate(ctx, chainID, types.NewProviderConsAddress(consAddr)); found { + // set the validator commission rate + val.Commission.CommissionRates.Rate = cr } + + // allocate the consumer reward tokens to the validator + k.distributionKeeper.AllocateTokensToValidator( + ctx, + val, + tokensFraction, + ) + + // sum the tokens allocated + allocated = allocated.Add(tokensFraction...) + } + + return allocated +} + +// TransferConsumerRewardsToDistributionModule transfers the rewards allocation of the given consumer chain +// from the consumer rewards pool to the distribution module +func (k Keeper) TransferConsumerRewardsToDistributionModule( + ctx sdk.Context, + chainID string, +) (sdk.Coins, error) { + // Get coins of the consumer rewards allocation + allocation := k.GetConsumerRewardsAllocation(ctx, chainID) + + if allocation.Rewards.IsZero() { + return sdk.Coins{}, nil + } + + // Truncate coin rewards + rewardsToSend, remRewards := allocation.Rewards.TruncateDecimal() + + // NOTE the consumer rewards allocation isn't a module account, however its coins + // are held in the consumer reward pool module account. Thus the consumer + // rewards allocation must be reduced separately from the SendCoinsFromModuleToAccount call. + + // Update consumer rewards allocation with the remaining decimal coins + allocation.Rewards = remRewards + + // Send coins to distribution module account + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ConsumerRewardsPool, distrtypes.ModuleName, rewardsToSend) + if err != nil { + return sdk.Coins{}, err + } + + k.SetConsumerRewardsAllocation(ctx, chainID, allocation) + return rewardsToSend, nil +} + +// consumer reward pools getter and setter + +// GetConsumerRewardsAllocation returns the consumer rewards allocation for the given chain ID +func (k Keeper) GetConsumerRewardsAllocation(ctx sdk.Context, chainID string) (pool types.ConsumerRewardsAllocation) { + store := ctx.KVStore(k.storeKey) + b := store.Get(types.ConsumerRewardsAllocationKey(chainID)) + k.cdc.MustUnmarshal(b, &pool) + return +} + +// SetConsumerRewardsAllocation sets the consumer rewards allocation for the given chain ID +func (k Keeper) SetConsumerRewardsAllocation(ctx sdk.Context, chainID string, pool types.ConsumerRewardsAllocation) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(&pool) + store.Set(types.ConsumerRewardsAllocationKey(chainID), b) +} + +// GetConsumerRewardsPool returns the balance +// of the consumer rewards pool module account +func (k Keeper) GetConsumerRewardsPool(ctx sdk.Context) sdk.Coins { + return k.bankKeeper.GetAllBalances( + ctx, + k.accountKeeper.GetModuleAccount(ctx, types.ConsumerRewardsPool).GetAddress(), + ) +} + +// ComputeConsumerTotalVotingPower returns the validator set total voting power +// for the given consumer chain +func (k Keeper) ComputeConsumerTotalVotingPower(ctx sdk.Context, chainID string) (totalPower int64) { + // sum the consumer validators set voting powers + for _, v := range k.GetConsumerValSet(ctx, chainID) { + totalPower += v.Power + } + + return +} + +// IdentifyConsumerChainIDFromIBCPacket checks if the packet destination matches a registered consumer chain. +// If so, it returns the consumer chain ID, otherwise an error. +func (k Keeper) IdentifyConsumerChainIDFromIBCPacket(ctx sdk.Context, packet channeltypes.Packet) (string, error) { + channel, ok := k.channelKeeper.GetChannel(ctx, packet.DestinationPort, packet.DestinationChannel) + if !ok { + return "", errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "channel not found for channel ID: %s", packet.DestinationChannel) + } + if len(channel.ConnectionHops) != 1 { + return "", errorsmod.Wrap(channeltypes.ErrTooManyConnectionHops, "must have direct connection to consumer chain") + } + connectionID := channel.ConnectionHops[0] + _, tmClient, err := k.getUnderlyingClient(ctx, connectionID) + if err != nil { + return "", err + } + + chainID := tmClient.ChainId + if _, ok := k.GetChainToChannel(ctx, chainID); !ok { + return "", errorsmod.Wrapf(types.ErrUnknownConsumerChannelId, "no CCV channel found for chain with ID: %s", chainID) + } + + return chainID, nil +} + +// HandleSetConsumerCommissionRate sets a per-consumer chain commission rate for the given provider address +// on the condition that the given consumer chain exists. +func (k Keeper) HandleSetConsumerCommissionRate(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, commissionRate math.LegacyDec) error { + // check that the consumer chain exists + if !k.IsConsumerProposedOrRegistered(ctx, chainID) { + return errorsmod.Wrapf( + types.ErrUnknownConsumerChainId, + "unknown consumer chain, with id: %s", chainID) + } + + // validate against the minimum commission rate + minRate, err := k.stakingKeeper.MinCommissionRate(ctx) + if err != nil { + return err + } + if commissionRate.LT(minRate) { + return errorsmod.Wrapf( + stakingtypes.ErrCommissionLTMinRate, + "commission rate cannot be less than %s", minRate, + ) } + // set per-consumer chain commission rate for the validator address + return k.SetConsumerCommissionRate( + ctx, + chainID, + providerAddr, + commissionRate, + ) } diff --git a/x/ccv/provider/keeper/distribution_test.go b/x/ccv/provider/keeper/distribution_test.go new file mode 100644 index 0000000000..0b22260a2b --- /dev/null +++ b/x/ccv/provider/keeper/distribution_test.go @@ -0,0 +1,273 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + + tmtypes "github.com/cometbft/cometbft/types" + + testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +func TestComputeConsumerTotalVotingPower(t *testing.T) { + keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + createVal := func(power int64) tmtypes.Validator { + signer := tmtypes.NewMockPV() + val := tmtypes.NewValidator(signer.PrivKey.PubKey(), power) + return *val + } + + chainID := "consumer" + expTotalPower := int64(0) + + // verify that the total power returned is equal to zero + // when the consumer doesn't exist or has no validators. + require.Zero(t, keeper.ComputeConsumerTotalVotingPower( + ctx, + chainID, + )) + + // set 5 validators to the consumer chain + for i := 0; i < 5; i++ { + val := createVal(int64(i)) + keeper.SetConsumerValidator( + ctx, + chainID, + types.ConsumerValidator{ + ProviderConsAddr: val.Address, + Power: val.VotingPower, + }, + ) + + expTotalPower += val.VotingPower + } + + // compute the total power of opted-in validators + res := keeper.ComputeConsumerTotalVotingPower( + ctx, + chainID, + ) + + // check the total power returned + require.Equal(t, expTotalPower, res) +} + +func TestIdentifyConsumerChainIDFromIBCPacket(t *testing.T) { + var ( + chainID = "consumer" + ccvChannel = "channel-0" + ) + + testCases := []struct { + name string + packet channeltypes.Packet + expectedCalls func(sdk.Context, testkeeper.MockedKeepers, channeltypes.Packet) []*gomock.Call + expCCVChannel bool + expErr bool + }{ + { + "channel not found", + channeltypes.NewPacket( + []byte{}, + 0, + "srcPort", + "srcChannel", + "dstPort", + "dstChannel", + clienttypes.NewHeight(1, 1), + 0, + ), + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, packet channeltypes.Packet) []*gomock.Call { + return []*gomock.Call{ + mocks.MockChannelKeeper.EXPECT().GetChannel( + ctx, + packet.DestinationPort, + packet.DestinationChannel, + ).Return(channeltypes.Channel{}, false).Times(1), + } + }, + false, + true, + }, + { + "connection hops can't be greater than 1", + channeltypes.NewPacket( + []byte{}, + 0, + "srcPort", + "srcChannel", + "dstPort", + "dstChannel", + clienttypes.NewHeight(1, 1), + 0, + ), + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, packet channeltypes.Packet) []*gomock.Call { + return []*gomock.Call{ + mocks.MockChannelKeeper.EXPECT().GetChannel( + ctx, + packet.DestinationPort, + packet.DestinationChannel, + ).Return(channeltypes.Channel{ConnectionHops: []string{"conn1", "conn2"}}, true).Times(1), + } + }, + false, + true, + }, + { + "underlying client isn't found", + channeltypes.NewPacket( + []byte{}, + 0, + "srcPort", + "srcChannel", + "dstPort", + "dstChannel", + clienttypes.NewHeight(1, 1), + 0, + ), + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, packet channeltypes.Packet) []*gomock.Call { + return []*gomock.Call{ + mocks.MockChannelKeeper.EXPECT().GetChannel( + ctx, + packet.DestinationPort, + packet.DestinationChannel, + ).Return(channeltypes.Channel{ConnectionHops: []string{"connectionID"}}, true).Times(1), + mocks.MockConnectionKeeper.EXPECT().GetConnection(ctx, "connectionID").Return( + conntypes.ConnectionEnd{ClientId: "clientID"}, true, + ).Times(1), + mocks.MockClientKeeper.EXPECT().GetClientState(ctx, "clientID").Return( + &ibctmtypes.ClientState{ChainId: ""}, false, + ).Times(1), + } + }, + false, + true, + }, + { + "no CCV channel registered", + channeltypes.NewPacket( + []byte{}, + 0, + "srcPort", + "srcChannel", + "dstPort", + "dstChannel", + clienttypes.NewHeight(1, 1), + 0, + ), + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, packet channeltypes.Packet) []*gomock.Call { + return []*gomock.Call{ + mocks.MockChannelKeeper.EXPECT().GetChannel( + ctx, + packet.DestinationPort, + packet.DestinationChannel, + ).Return(channeltypes.Channel{ConnectionHops: []string{"connectionID"}}, true).Times(1), + mocks.MockConnectionKeeper.EXPECT().GetConnection(ctx, "connectionID").Return( + conntypes.ConnectionEnd{ClientId: "clientID"}, true, + ).Times(1), + mocks.MockClientKeeper.EXPECT().GetClientState(ctx, "clientID").Return( + &ibctmtypes.ClientState{ChainId: chainID}, true, + ).Times(1), + } + }, + false, + true, + }, + { + "consumer chain identified", + channeltypes.NewPacket( + []byte{}, + 0, + "srcPort", + "srcChannel", + "dstPort", + "dstChannel", + clienttypes.NewHeight(1, 1), + 0, + ), + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, packet channeltypes.Packet) []*gomock.Call { + return []*gomock.Call{ + mocks.MockChannelKeeper.EXPECT().GetChannel( + ctx, + packet.DestinationPort, + packet.DestinationChannel, + ), + } + }, + false, + true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + keeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + tc.expectedCalls(ctx, mocks, tc.packet) + _, err := keeper.IdentifyConsumerChainIDFromIBCPacket( + ctx, + tc.packet, + ) + + if tc.expCCVChannel { + keeper.SetChainToChannel(ctx, chainID, ccvChannel) + } + + if !tc.expErr { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} + +func TestSetConsumerRewardsAllocation(t *testing.T) { + keeperParams := testkeeper.NewInMemKeeperParams(t) + ctx := keeperParams.Ctx + + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mocks := testkeeper.NewMockedKeepers(ctrl) + providerKeeper := testkeeper.NewInMemProviderKeeper(keeperParams, mocks) + + rewardAllocation := providertypes.ConsumerRewardsAllocation{ + Rewards: sdk.NewDecCoins(sdk.NewDecCoin("uatom", math.NewInt(1000))), + } + + providerKeeper.SetConsumerRewardsAllocation(ctx, "consumer-1", rewardAllocation) + + alloc := providerKeeper.GetConsumerRewardsAllocation(ctx, "consumer-1") + require.Equal(t, rewardAllocation, alloc) +} + +func TestGetConsumerRewardsAllocationNil(t *testing.T) { + keeperParams := testkeeper.NewInMemKeeperParams(t) + ctx := keeperParams.Ctx + + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mocks := testkeeper.NewMockedKeepers(ctrl) + providerKeeper := testkeeper.NewInMemProviderKeeper(keeperParams, mocks) + + alloc := providerKeeper.GetConsumerRewardsAllocation(ctx, "consumer-1") + + expectedRewardAllocation := providertypes.ConsumerRewardsAllocation{ + Rewards: nil, + } + require.Equal(t, expectedRewardAllocation, alloc) +} diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index daaca81e81..4ff0a2c74c 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -45,7 +46,6 @@ func (k Keeper) QueryConsumerChains(goCtx context.Context, req *types.QueryConsu ctx := sdk.UnwrapSDKContext(goCtx) - // convert to array of pointers chains := []*types.Chain{} for _, chain := range k.GetAllConsumerChains(ctx) { // prevent implicit memory aliasing @@ -229,6 +229,142 @@ func (k Keeper) QueryParams(goCtx context.Context, req *types.QueryParamsRequest return &types.QueryParamsResponse{Params: params}, nil } +// QueryConsumerChainOptedInValidators returns all validators that opted-in to a given consumer chain +func (k Keeper) QueryConsumerChainOptedInValidators(goCtx context.Context, req *types.QueryConsumerChainOptedInValidatorsRequest) (*types.QueryConsumerChainOptedInValidatorsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + consumerChainID := req.ChainId + if consumerChainID == "" { + return nil, status.Error(codes.InvalidArgument, "empty chainId") + } + + optedInVals := []string{} + ctx := sdk.UnwrapSDKContext(goCtx) + + if !k.IsConsumerProposedOrRegistered(ctx, consumerChainID) { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown consumer chain: %s", consumerChainID)) + } + + for _, v := range k.GetAllOptedIn(ctx, consumerChainID) { + optedInVals = append(optedInVals, v.ToSdkConsAddr().String()) + } + + return &types.QueryConsumerChainOptedInValidatorsResponse{ + ValidatorsProviderAddresses: optedInVals, + }, nil +} + +// QueryConsumerValidators returns all validators that are consumer validators in a given consumer chain +func (k Keeper) QueryConsumerValidators(goCtx context.Context, req *types.QueryConsumerValidatorsRequest) (*types.QueryConsumerValidatorsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + consumerChainID := req.ChainId + if consumerChainID == "" { + return nil, status.Error(codes.InvalidArgument, "empty chainId") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + if _, found := k.GetConsumerClientId(ctx, consumerChainID); !found { + // chain has to have started; consumer client id is set for a chain during the chain's spawn time + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("no started consumer chain: %s", consumerChainID)) + } + + var validators []*types.QueryConsumerValidatorsValidator + for _, v := range k.GetConsumerValSet(ctx, consumerChainID) { + validators = append(validators, &types.QueryConsumerValidatorsValidator{ + ProviderAddress: sdk.ConsAddress(v.ProviderConsAddr).String(), + ConsumerKey: v.ConsumerPublicKey, + Power: v.Power, + }) + } + + return &types.QueryConsumerValidatorsResponse{ + Validators: validators, + }, nil +} + +// QueryConsumerChainsValidatorHasToValidate returns all consumer chains that the given validator has to validate now +// or in the next epoch if nothing changes. +func (k Keeper) QueryConsumerChainsValidatorHasToValidate(goCtx context.Context, req *types.QueryConsumerChainsValidatorHasToValidateRequest) (*types.QueryConsumerChainsValidatorHasToValidateResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if req.ProviderAddress == "" { + return nil, status.Error(codes.InvalidArgument, "empty provider address") + } + + consAddr, err := sdk.ConsAddressFromBech32(req.ProviderAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid provider address") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + provAddr := types.NewProviderConsAddress(consAddr) + + // get all the consumer chains for which the validator is either already + // opted-in, currently a consumer validator or if its voting power is within the TopN validators + consumersToValidate := []string{} + for _, consumer := range k.GetAllConsumerChains(ctx) { + chainID := consumer.ChainId + + if hasToValidate, err := k.HasToValidate(ctx, provAddr, chainID); err == nil && hasToValidate { + consumersToValidate = append(consumersToValidate, chainID) + } + } + + return &types.QueryConsumerChainsValidatorHasToValidateResponse{ + ConsumerChainIds: consumersToValidate, + }, nil +} + +// QueryValidatorConsumerCommissionRate returns the commission rate a given +// validator charges on a given consumer chain +func (k Keeper) QueryValidatorConsumerCommissionRate(goCtx context.Context, req *types.QueryValidatorConsumerCommissionRateRequest) (*types.QueryValidatorConsumerCommissionRateResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + consumerChainID := req.ChainId + if consumerChainID == "" { + return nil, status.Error(codes.InvalidArgument, "empty chainId") + } + + consAddr, err := sdk.ConsAddressFromBech32(req.ProviderAddress) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid provider address") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + if !k.IsConsumerProposedOrRegistered(ctx, consumerChainID) { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown consumer chain: %s", consumerChainID)) + } + + res := &types.QueryValidatorConsumerCommissionRateResponse{} + + // Check if the validator has a commission rate set for the consumer chain, + // otherwise use the commission rate from the validator staking module struct + consumerRate, found := k.GetConsumerCommissionRate(ctx, consumerChainID, types.NewProviderConsAddress(consAddr)) + if found { + res.Rate = consumerRate + } else { + v, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, consAddr) + if err != nil { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("unknown validator: %s", consAddr.String())) + } + res.Rate = v.Commission.Rate + } + + return res, nil +} + func (k Keeper) QueryOldestUnconfirmedVsc(goCtx context.Context, req *types.QueryOldestUnconfirmedVscRequest) (*types.QueryOldestUnconfirmedVscResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 3e252a7069..c5d9520c6b 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -4,6 +4,10 @@ import ( "testing" "time" + "cosmossdk.io/math" + "github.com/cometbft/cometbft/proto/tendermint/crypto" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stretchr/testify/require" sdktypes "github.com/cosmos/cosmos-sdk/types" @@ -102,3 +106,147 @@ func TestQueryOldestUnconfirmedVsc(t *testing.T) { } require.Equal(t, expectedResult, response.VscSendTimestamp) } + +func TestQueryConsumerChainOptedInValidators(t *testing.T) { + chainID := "chainID" + + pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + req := types.QueryConsumerChainOptedInValidatorsRequest{ + ChainId: chainID, + } + + // error returned from not yet proposed or not yet registered chain + _, err := pk.QueryConsumerChainOptedInValidators(ctx, &req) + require.Error(t, err) + + pk.SetProposedConsumerChain(ctx, chainID, 1) + + providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) + providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) + expectedResponse := types.QueryConsumerChainOptedInValidatorsResponse{ + ValidatorsProviderAddresses: []string{providerAddr1.String(), providerAddr2.String()}, + } + + pk.SetOptedIn(ctx, chainID, providerAddr1) + pk.SetOptedIn(ctx, chainID, providerAddr2) + res, err := pk.QueryConsumerChainOptedInValidators(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) +} + +func TestQueryConsumerValidators(t *testing.T) { + chainID := "chainID" + + pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + req := types.QueryConsumerValidatorsRequest{ + ChainId: chainID, + } + + // error returned from not-started chain + _, err := pk.QueryConsumerValidators(ctx, &req) + require.Error(t, err) + + providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) + consumerKey1 := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() + consumerValidator1 := types.ConsumerValidator{ProviderConsAddr: providerAddr1.ToSdkConsAddr(), Power: 1, ConsumerPublicKey: &consumerKey1} + + providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) + consumerKey2 := cryptotestutil.NewCryptoIdentityFromIntSeed(2).TMProtoCryptoPublicKey() + consumerValidator2 := types.ConsumerValidator{ProviderConsAddr: providerAddr2.ToSdkConsAddr(), Power: 2, ConsumerPublicKey: &consumerKey2} + + expectedResponse := types.QueryConsumerValidatorsResponse{ + Validators: []*types.QueryConsumerValidatorsValidator{ + {providerAddr1.String(), &consumerKey1, 1}, + {providerAddr2.String(), &consumerKey2, 2}, + }, + } + + // set up the client id so the chain looks like it "started" + pk.SetConsumerClientId(ctx, chainID, "clientID") + pk.SetConsumerValSet(ctx, chainID, []types.ConsumerValidator{consumerValidator1, consumerValidator2}) + + res, err := pk.QueryConsumerValidators(ctx, &req) + require.NoError(t, err) + require.Equal(t, &expectedResponse, res) +} + +func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { + pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + val := createStakingValidator(ctx, mocks, 1, 1, 1) + valConsAddr, _ := val.GetConsAddr() + providerAddr := types.NewProviderConsAddress(valConsAddr) + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valConsAddr).Return(val, nil).AnyTimes() + mocks.MockStakingKeeper.EXPECT().GetLastValidators(ctx).Return([]stakingtypes.Validator{val}, nil).AnyTimes() + + req := types.QueryConsumerChainsValidatorHasToValidateRequest{ + ProviderAddress: providerAddr.String(), + } + + // set up some consumer chains + consumerChains := []string{"chain1", "chain2", "chain3", "chain4"} + for _, cc := range consumerChains { + pk.SetConsumerClientId(ctx, cc, "clientID") + } + + // set `providerAddr` as a consumer validator on "chain1" + pk.SetConsumerValidator(ctx, "chain1", types.ConsumerValidator{ + ProviderConsAddr: providerAddr.ToSdkConsAddr(), + Power: 1, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{1}, + }}}) + + // set `providerAddr` as an opted-in validator on "chain3" + pk.SetOptedIn(ctx, "chain3", providerAddr) + + // `providerAddr` has to validate "chain1" because it is a consumer validator in this chain, as well as "chain3" + // because it opted in, in "chain3" and `providerAddr` belongs to the bonded validators (see the mocking of `GetLastValidators` + // above) + expectedChains := []string{"chain1", "chain3"} + + res, err := pk.QueryConsumerChainsValidatorHasToValidate(ctx, &req) + require.NoError(t, err) + require.Equal(t, expectedChains, res.ConsumerChainIds) +} + +func TestQueryValidatorConsumerCommissionRate(t *testing.T) { + chainID := "chainID" + + pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) + req := types.QueryValidatorConsumerCommissionRateRequest{ + ChainId: chainID, + ProviderAddress: providerAddr.String(), + } + + // error returned from not yet proposed or not yet registered chain + _, err := pk.QueryValidatorConsumerCommissionRate(ctx, &req) + require.Error(t, err) + + pk.SetProposedConsumerChain(ctx, chainID, 1) + // validator with set consumer commission rate + expectedCommissionRate := math.LegacyMustNewDecFromStr("0.123") + pk.SetConsumerCommissionRate(ctx, chainID, providerAddr, expectedCommissionRate) + res, _ := pk.QueryValidatorConsumerCommissionRate(ctx, &req) + require.Equal(t, expectedCommissionRate, res.Rate) + + // validator with no set consumer commission rate + pk.DeleteConsumerCommissionRate(ctx, chainID, providerAddr) + expectedCommissionRate = math.LegacyMustNewDecFromStr("0.456") + + // because no consumer commission rate is set, the validator's set commission rate on the provider is used + val := stakingtypes.Validator{Commission: stakingtypes.Commission{CommissionRates: stakingtypes.CommissionRates{Rate: expectedCommissionRate}}} + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( + ctx, providerAddr.ToSdkConsAddr()).Return(val, nil).Times(1) + res, _ = pk.QueryValidatorConsumerCommissionRate(ctx, &req) + require.Equal(t, expectedCommissionRate, res.Rate) +} diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index dee2b7869e..2131a974b0 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -38,9 +38,65 @@ func (h Hooks) AfterUnbondingInitiated(goCtx context.Context, id uint64) error { var consumerChainIDS []string ctx := sdk.UnwrapSDKContext(goCtx) - for _, chain := range h.k.GetAllConsumerChains(ctx) { - consumerChainIDS = append(consumerChainIDS, chain.ChainId) + // get validator address from unbonding operation + unbondingType, err := h.k.stakingKeeper.GetUnbondingType(ctx, id) + vadAddrBech32 := "" + if err != nil { + ctx.Logger().Error("undefined type for unbonding operation: id: %d: %s", id, err) + return nil + } + + switch unbondingType { + case stakingtypes.UnbondingType_UnbondingDelegation: + ubd, err := h.k.stakingKeeper.GetUnbondingDelegationByUnbondingID(ctx, id) + if err != nil { + ctx.Logger().Error("unfound ubonding delegation for unbonding id: %d: %s", id, err) + return nil + } + vadAddrBech32 = ubd.ValidatorAddress + case stakingtypes.UnbondingType_Redelegation: + red, err := h.k.stakingKeeper.GetRedelegationByUnbondingID(ctx, id) + if err != nil { + ctx.Logger().Error("unfound relegation for unbonding operation id: %d: %s", id, err) + return nil + } + vadAddrBech32 = red.ValidatorSrcAddress + case stakingtypes.UnbondingType_ValidatorUnbonding: + val, err := h.k.stakingKeeper.GetValidatorByUnbondingID(ctx, id) + if err != nil { + ctx.Logger().Error("unfound validator for unbonding operation id: %d: %s", id, err) + return nil + } + vadAddrBech32 = val.OperatorAddress + default: + ctx.Logger().Error("invalid unbonding operation type: %s", unbondingType) + return nil + } + + valAddr, err := sdk.ValAddressFromBech32(vadAddrBech32) + if err != nil { + ctx.Logger().Error(err.Error()) + return nil + } + + validator, err := h.k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + ctx.Logger().Error("unfound validator for validator address: %s: %s", vadAddrBech32, err) + return nil + } + + consAddr, err := validator.GetConsAddr() + if err != nil { + ctx.Logger().Error(err.Error()) + return nil + } + + // get all consumers where the validator is in the validator set + for _, chain := range h.k.GetAllConsumerChains(ctx) { + if h.k.IsConsumerValidator(ctx, chain.ChainId, providertypes.NewProviderConsAddress(consAddr)) { + consumerChainIDS = append(consumerChainIDS, chain.ChainId) + } } if len(consumerChainIDS) == 0 { diff --git a/x/ccv/provider/keeper/hooks_test.go b/x/ccv/provider/keeper/hooks_test.go index 2a6d60db85..2447b5edf3 100644 --- a/x/ccv/provider/keeper/hooks_test.go +++ b/x/ccv/provider/keeper/hooks_test.go @@ -3,13 +3,11 @@ package keeper_test import ( "testing" - "github.com/golang/mock/gomock" - sdk "github.com/cosmos/cosmos-sdk/types" - cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + "github.com/golang/mock/gomock" ) func TestValidatorConsensusKeyInUse(t *testing.T) { diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index a697eb1b4a..042f05a285 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -8,6 +8,7 @@ import ( "time" addresscodec "cosmossdk.io/core/address" + "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" @@ -214,9 +215,14 @@ func (k Keeper) SetProposedConsumerChain(ctx sdk.Context, chainID string, propos } // GetProposedConsumerChain returns the proposed chainID for the given consumerAddition proposal ID. -func (k Keeper) GetProposedConsumerChain(ctx sdk.Context, proposalID uint64) string { +// This method is only used for testing. +func (k Keeper) GetProposedConsumerChain(ctx sdk.Context, proposalID uint64) (string, bool) { store := ctx.KVStore(k.storeKey) - return string(store.Get(types.ProposedConsumerChainKey(proposalID))) + consumerChain := store.Get(types.ProposedConsumerChainKey(proposalID)) + if consumerChain != nil { + return string(consumerChain), true + } + return "", false } // DeleteProposedConsumerChainInStore deletes the consumer chainID from store @@ -276,9 +282,50 @@ func (k Keeper) GetAllConsumerChains(ctx sdk.Context) (chains []types.Chain) { chainID := string(iterator.Key()[1:]) clientID := string(iterator.Value()) + topN, found := k.GetTopN(ctx, chainID) + + var minPowerInTopN int64 + if found && topN > 0 { + lastVals, err := k.stakingKeeper.GetLastValidators(ctx) + if err != nil { + k.Logger(ctx).Error("failed to get last validators", "chain", chainID, "error", err) + minPowerInTopN = -1 + } else { + res, err := k.ComputeMinPowerToOptIn(ctx, lastVals, topN) + if err != nil { + k.Logger(ctx).Error("failed to compute min power to opt in for chain", "chain", chainID, "error", err) + minPowerInTopN = -1 + } else { + minPowerInTopN = res + } + } + } else { + minPowerInTopN = -1 + } + + validatorSetCap, _ := k.GetValidatorSetCap(ctx, chainID) + validatorsPowerCap, _ := k.GetValidatorsPowerCap(ctx, chainID) + allowlist := k.GetAllowList(ctx, chainID) + strAllowlist := make([]string, len(allowlist)) + for i, addr := range allowlist { + strAllowlist[i] = addr.String() + } + + denylist := k.GetDenyList(ctx, chainID) + strDenylist := make([]string, len(denylist)) + for i, addr := range denylist { + strDenylist[i] = addr.String() + } + chains = append(chains, types.Chain{ - ChainId: chainID, - ClientId: clientID, + ChainId: chainID, + ClientId: clientID, + Top_N: topN, + MinPowerInTop_N: minPowerInTopN, + ValidatorSetCap: validatorSetCap, + ValidatorsPowerCap: validatorsPowerCap, + Allowlist: strAllowlist, + Denylist: strDenylist, }) } @@ -747,13 +794,9 @@ func (k Keeper) GetValidatorSetUpdateId(ctx sdk.Context) (validatorSetUpdateId u bz := store.Get(types.ValidatorSetUpdateIdKey()) if bz == nil { - validatorSetUpdateId = 0 - } else { - // Unmarshal - validatorSetUpdateId = binary.BigEndian.Uint64(bz) + return 0 } - - return validatorSetUpdateId + return binary.BigEndian.Uint64(bz) } // SetValsetUpdateBlockHeight sets the block height for a given valset update id @@ -1165,3 +1208,429 @@ func (k Keeper) GetAllRegisteredAndProposedChainIDs(ctx sdk.Context) []string { return allConsumerChains } + +// SetTopN stores the N value associated to chain with `chainID` +func (k Keeper) SetTopN( + ctx sdk.Context, + chainID string, + N uint32, +) { + store := ctx.KVStore(k.storeKey) + + buf := make([]byte, 4) + binary.BigEndian.PutUint32(buf, N) + + store.Set(types.TopNKey(chainID), buf) +} + +// DeleteTopN removes the N value associated to chain with `chainID` +func (k Keeper) DeleteTopN( + ctx sdk.Context, + chainID string, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.TopNKey(chainID)) +} + +// GetTopN returns (N, true) if chain `chainID` has a top N associated, and (0, false) otherwise. +func (k Keeper) GetTopN( + ctx sdk.Context, + chainID string, +) (uint32, bool) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.TopNKey(chainID)) + if buf == nil { + return 0, false + } + return binary.BigEndian.Uint32(buf), true +} + +// IsTopN returns true if chain with `chainID` is a Top-N chain (i.e., enforces at least one validator to validate chain `chainID`) +func (k Keeper) IsTopN(ctx sdk.Context, chainID string) bool { + topN, found := k.GetTopN(ctx, chainID) + return found && topN > 0 +} + +// IsOptIn returns true if chain with `chainID` is an Opt-In chain (i.e., no validator is forced to validate chain `chainID`) +func (k Keeper) IsOptIn(ctx sdk.Context, chainID string) bool { + topN, found := k.GetTopN(ctx, chainID) + return !found || topN == 0 +} + +func (k Keeper) SetOptedIn( + ctx sdk.Context, + chainID string, + providerConsAddress types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Set(types.OptedInKey(chainID, providerConsAddress), []byte{}) +} + +func (k Keeper) DeleteOptedIn( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.OptedInKey(chainID, providerAddr)) +} + +func (k Keeper) IsOptedIn( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) bool { + store := ctx.KVStore(k.storeKey) + return store.Get(types.OptedInKey(chainID, providerAddr)) != nil +} + +// GetAllOptedIn returns all the opted-in validators on chain `chainID` +func (k Keeper) GetAllOptedIn( + ctx sdk.Context, + chainID string, +) (providerConsAddresses []types.ProviderConsAddress) { + store := ctx.KVStore(k.storeKey) + key := types.ChainIdWithLenKey(types.OptedInBytePrefix, chainID) + iterator := storetypes.KVStorePrefixIterator(store, key) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + providerConsAddresses = append(providerConsAddresses, types.NewProviderConsAddress(iterator.Key()[len(key):])) + } + + return providerConsAddresses +} + +// DeleteAllOptedIn deletes all the opted-in validators for chain with `chainID` +func (k Keeper) DeleteAllOptedIn( + ctx sdk.Context, + chainID string, +) { + store := ctx.KVStore(k.storeKey) + key := types.ChainIdWithLenKey(types.OptedInBytePrefix, chainID) + iterator := storetypes.KVStorePrefixIterator(store, key) + + var keysToDel [][]byte + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + for _, delKey := range keysToDel { + store.Delete(delKey) + } +} + +func (k Keeper) HasToValidate( + ctx sdk.Context, + provAddr types.ProviderConsAddress, + chainID string, +) (bool, error) { + // if the validator was sent as part of the packet in the last epoch, it has to validate + if k.IsConsumerValidator(ctx, chainID, provAddr) { + return true, nil + } + + // if the validator was not part of the last epoch, check if the validator is going to be part of te next epoch + bondedValidators, err := k.stakingKeeper.GetLastValidators(ctx) + if err != nil { + return false, err + } + if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { + // in a Top-N chain, we automatically opt in all validators that belong to the top N + minPower, err := k.ComputeMinPowerToOptIn(ctx, bondedValidators, topN) + if err == nil { + k.OptInTopNValidators(ctx, chainID, bondedValidators, minPower) + } else { + k.Logger(ctx).Error("failed to compute min power to opt in for chain", "chain", chainID, "error", err) + } + } + + // if the validator is opted in and belongs to the validators of the next epoch, then if nothing changes + // the validator would have to validate in the next epoch + if k.IsOptedIn(ctx, chainID, provAddr) { + lastVals, err := k.stakingKeeper.GetLastValidators(ctx) + if err != nil { + return false, err + } + nextValidators := k.ComputeNextValidators(ctx, chainID, lastVals) + for _, v := range nextValidators { + consAddr := sdk.ConsAddress(v.ProviderConsAddr) + if provAddr.ToSdkConsAddr().Equals(consAddr) { + return true, nil + } + } + } + + return false, nil +} + +// SetConsumerCommissionRate sets a per-consumer chain commission rate +// for the given validator address +func (k Keeper) SetConsumerCommissionRate( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, + commissionRate math.LegacyDec, +) error { + store := ctx.KVStore(k.storeKey) + bz, err := commissionRate.Marshal() + if err != nil { + err = fmt.Errorf("consumer commission rate marshalling failed: %s", err) + k.Logger(ctx).Error(err.Error()) + return err + } + + store.Set(types.ConsumerCommissionRateKey(chainID, providerAddr), bz) + return nil +} + +// GetConsumerCommissionRate returns the per-consumer commission rate set +// for the given validator address +func (k Keeper) GetConsumerCommissionRate( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) (math.LegacyDec, bool) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerCommissionRateKey(chainID, providerAddr)) + if bz == nil { + return math.LegacyZeroDec(), false + } + + cr := math.LegacyZeroDec() + // handle error gracefully since it's called in BeginBlockRD + if err := cr.Unmarshal(bz); err != nil { + k.Logger(ctx).Error("consumer commission rate unmarshalling failed: %s", err) + return cr, false + } + + return cr, true +} + +// GetAllCommissionRateValidators returns all the validator address +// that set a commission rate for the given chain ID +func (k Keeper) GetAllCommissionRateValidators( + ctx sdk.Context, + chainID string, +) (addresses []types.ProviderConsAddress) { + store := ctx.KVStore(k.storeKey) + key := types.ChainIdWithLenKey(types.ConsumerCommissionRatePrefix, chainID) + iterator := storetypes.KVStorePrefixIterator(store, key) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + providerAddr := types.NewProviderConsAddress(iterator.Key()[len(key):]) + addresses = append(addresses, providerAddr) + } + + return addresses +} + +// DeleteConsumerCommissionRate the per-consumer chain commission rate +// associated to the given validator address +func (k Keeper) DeleteConsumerCommissionRate( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ConsumerCommissionRateKey(chainID, providerAddr)) +} + +// SetValidatorsPowerCap sets the power-cap value `p` associated to chain with `chainID` +func (k Keeper) SetValidatorsPowerCap( + ctx sdk.Context, + chainID string, + p uint32, +) { + store := ctx.KVStore(k.storeKey) + + buf := make([]byte, 4) + binary.BigEndian.PutUint32(buf, p) + + store.Set(types.ValidatorsPowerCapKey(chainID), buf) +} + +// DeleteValidatorsPowerCap removes the power-cap value associated to chain with `chainID` +func (k Keeper) DeleteValidatorsPowerCap( + ctx sdk.Context, + chainID string, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ValidatorsPowerCapKey(chainID)) +} + +// GetValidatorsPowerCap returns `(p, true)` if chain `chainID` has power cap `p` associated with it, and (0, false) otherwise +func (k Keeper) GetValidatorsPowerCap( + ctx sdk.Context, + chainID string, +) (uint32, bool) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.ValidatorsPowerCapKey(chainID)) + if buf == nil { + return 0, false + } + return binary.BigEndian.Uint32(buf), true +} + +// SetValidatorSetCap stores the validator-set cap value `c` associated to chain with `chainID` +func (k Keeper) SetValidatorSetCap( + ctx sdk.Context, + chainID string, + c uint32, +) { + store := ctx.KVStore(k.storeKey) + + buf := make([]byte, 4) + binary.BigEndian.PutUint32(buf, c) + + store.Set(types.ValidatorSetCapKey(chainID), buf) +} + +// DeleteValidatorSetCap removes the validator-set cap value associated to chain with `chainID` +func (k Keeper) DeleteValidatorSetCap( + ctx sdk.Context, + chainID string, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.ValidatorSetCapKey(chainID)) +} + +// GetValidatorSetCap returns `(c, true)` if chain `chainID` has validator-set cap `c` associated with it, and (0, false) otherwise +func (k Keeper) GetValidatorSetCap( + ctx sdk.Context, + chainID string, +) (uint32, bool) { + store := ctx.KVStore(k.storeKey) + buf := store.Get(types.ValidatorSetCapKey(chainID)) + if buf == nil { + return 0, false + } + return binary.BigEndian.Uint32(buf), true +} + +// SetAllowlist allowlists validator with `providerAddr` address on chain `chainID` +func (k Keeper) SetAllowlist( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Set(types.AllowlistCapKey(chainID, providerAddr), []byte{}) +} + +// GetAllowList returns all allowlisted validators +func (k Keeper) GetAllowList( + ctx sdk.Context, + chainID string, +) (providerConsAddresses []types.ProviderConsAddress) { + store := ctx.KVStore(k.storeKey) + key := types.ChainIdWithLenKey(types.AllowlistPrefix, chainID) + iterator := storetypes.KVStorePrefixIterator(store, key) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + providerConsAddresses = append(providerConsAddresses, types.NewProviderConsAddress(iterator.Key()[len(key):])) + } + + return providerConsAddresses +} + +// IsAllowlisted returns `true` if validator with `providerAddr` has been allowlisted on chain `chainID` +func (k Keeper) IsAllowlisted( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) bool { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.AllowlistCapKey(chainID, providerAddr)) + return bz != nil +} + +// DeleteAllowlist deletes all allowlisted validators +func (k Keeper) DeleteAllowlist(ctx sdk.Context, chainID string) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.AllowlistPrefix, chainID)) + defer iterator.Close() + + keysToDel := [][]byte{} + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + + for _, key := range keysToDel { + store.Delete(key) + } +} + +// IsAllowlistEmpty returns `true` if no validator is allowlisted on chain `chainID` +func (k Keeper) IsAllowlistEmpty(ctx sdk.Context, chainID string) bool { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.AllowlistPrefix, chainID)) + defer iterator.Close() + + return !iterator.Valid() +} + +// SetDenylist denylists validator with `providerAddr` address on chain `chainID` +func (k Keeper) SetDenylist( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Set(types.DenylistCapKey(chainID, providerAddr), []byte{}) +} + +// GetDenyList returns all denylisted validators +func (k Keeper) GetDenyList( + ctx sdk.Context, + chainID string, +) (providerConsAddresses []types.ProviderConsAddress) { + store := ctx.KVStore(k.storeKey) + key := types.ChainIdWithLenKey(types.DenylistPrefix, chainID) + iterator := storetypes.KVStorePrefixIterator(store, key) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + providerConsAddresses = append(providerConsAddresses, types.NewProviderConsAddress(iterator.Key()[len(key):])) + } + + return providerConsAddresses +} + +// IsDenylisted returns `true` if validator with `providerAddr` has been denylisted on chain `chainID` +func (k Keeper) IsDenylisted( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) bool { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.DenylistCapKey(chainID, providerAddr)) + return bz != nil +} + +// DeleteDenylist deletes all denylisted validators +func (k Keeper) DeleteDenylist(ctx sdk.Context, chainID string) { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.DenylistPrefix, chainID)) + defer iterator.Close() + + keysToDel := [][]byte{} + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + + for _, key := range keysToDel { + store.Delete(key) + } +} + +// IsDenylistEmpty returns `true` if no validator is denylisted on chain `chainID` +func (k Keeper) IsDenylistEmpty(ctx sdk.Context, chainID string) bool { + store := ctx.KVStore(k.storeKey) + iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.DenylistPrefix, chainID)) + defer iterator.Close() + + return !iterator.Valid() +} diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index 6e117551b7..23f3cc00ef 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -1,15 +1,19 @@ package keeper_test import ( + "bytes" "fmt" "sort" "testing" "time" + "cosmossdk.io/math" ibctesting "github.com/cosmos/ibc-go/v8/testing" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/cometbft/cometbft/abci/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" @@ -18,6 +22,8 @@ import ( testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" + + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) const consumer = "consumer" @@ -393,15 +399,87 @@ func TestVscSendTimestamp(t *testing.T) { // TestGetAllConsumerChains tests GetAllConsumerChains behaviour correctness func TestGetAllConsumerChains(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() chainIDs := []string{"chain-2", "chain-1", "chain-4", "chain-3"} + + // mock the validator set + vals := []stakingtypes.Validator{ + {OperatorAddress: "cosmosvaloper1c4k24jzduc365kywrsvf5ujz4ya6mwympnc4en"}, // 50 power + {OperatorAddress: "cosmosvaloper196ax4vc0lwpxndu9dyhvca7jhxp70rmcvrj90c"}, // 150 power + {OperatorAddress: "cosmosvaloper1clpqr4nrk4khgkxj78fcwwh6dl3uw4epsluffn"}, // 300 power + {OperatorAddress: "cosmosvaloper1tflk30mq5vgqjdly92kkhhq3raev2hnz6eete3"}, // 500 power + } + powers := []int64{50, 150, 300, 500} // sum = 1000 + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Return(vals, nil).AnyTimes() + + for i, val := range vals { + valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) + require.NoError(t, err) + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAddr).Return(powers[i], nil).AnyTimes() + } + + // set Top N parameters, client ids and expected result + topNs := []uint32{0, 70, 90, 100} + expectedMinPowerInTopNs := []int64{ + -1, // Top N is 0, so not a Top N chain + 300, // 500 and 300 are in Top 70% + 150, // 150 is also in the top 90%, + 50, // everyone is in the top 100% + } + + validatorSetCaps := []uint32{0, 5, 10, 20} + validatorPowerCaps := []uint32{0, 5, 10, 33} + allowlists := [][]types.ProviderConsAddress{ + {}, + {types.NewProviderConsAddress([]byte("providerAddr1")), types.NewProviderConsAddress([]byte("providerAddr2"))}, + {types.NewProviderConsAddress([]byte("providerAddr3"))}, + {}, + } + + denylists := [][]types.ProviderConsAddress{ + {types.NewProviderConsAddress([]byte("providerAddr4")), types.NewProviderConsAddress([]byte("providerAddr5"))}, + {}, + {types.NewProviderConsAddress([]byte("providerAddr6"))}, + {}, + } + expectedGetAllOrder := []types.Chain{} for i, chainID := range chainIDs { clientID := fmt.Sprintf("client-%d", len(chainIDs)-i) + topN := topNs[i] pk.SetConsumerClientId(ctx, chainID, clientID) - expectedGetAllOrder = append(expectedGetAllOrder, types.Chain{ChainId: chainID, ClientId: clientID}) + pk.SetTopN(ctx, chainID, topN) + pk.SetValidatorSetCap(ctx, chainID, validatorSetCaps[i]) + pk.SetValidatorsPowerCap(ctx, chainID, validatorPowerCaps[i]) + for _, addr := range allowlists[i] { + pk.SetAllowlist(ctx, chainID, addr) + } + for _, addr := range denylists[i] { + pk.SetDenylist(ctx, chainID, addr) + } + strAllowlist := make([]string, len(allowlists[i])) + for j, addr := range allowlists[i] { + strAllowlist[j] = addr.String() + } + + strDenylist := make([]string, len(denylists[i])) + for j, addr := range denylists[i] { + strDenylist[j] = addr.String() + } + + expectedGetAllOrder = append(expectedGetAllOrder, + types.Chain{ + ChainId: chainID, + ClientId: clientID, + Top_N: topN, + MinPowerInTop_N: expectedMinPowerInTopNs[i], + ValidatorSetCap: validatorSetCaps[i], + ValidatorsPowerCap: validatorPowerCaps[i], + Allowlist: strAllowlist, + Denylist: strDenylist, + }) } // sorting by chainID sort.Slice(expectedGetAllOrder, func(i, j int) bool { @@ -550,7 +628,7 @@ func TestSetProposedConsumerChains(t *testing.T) { for _, test := range tests { providerKeeper.SetProposedConsumerChain(ctx, test.chainID, test.proposalID) - cID := providerKeeper.GetProposedConsumerChain(ctx, test.proposalID) + cID, _ := providerKeeper.GetProposedConsumerChain(ctx, test.proposalID) require.Equal(t, cID, test.chainID) } } @@ -572,9 +650,9 @@ func TestDeleteProposedConsumerChainInStore(t *testing.T) { for _, test := range tests { providerKeeper.SetProposedConsumerChain(ctx, test.chainID, test.proposalID) providerKeeper.DeleteProposedConsumerChainInStore(ctx, test.deleteProposalID) - cID := providerKeeper.GetProposedConsumerChain(ctx, test.proposalID) + cID, found := providerKeeper.GetProposedConsumerChain(ctx, test.proposalID) if test.ok { - require.Equal(t, cID, "") + require.False(t, found) } else { require.Equal(t, cID, test.chainID) } @@ -628,3 +706,208 @@ func TestGetAllProposedConsumerChainIDs(t *testing.T) { } } } + +// TestTopN tests the `SetTopN`, `GetTopN`, `IsTopN`, and `IsOptIn` methods +func TestTopN(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + tests := []struct { + chainID string + N uint32 + isOptIn bool + }{ + {chainID: "TopNChain1", N: 50, isOptIn: false}, + {chainID: "TopNChain2", N: 100, isOptIn: false}, + {chainID: "OptInChain", N: 0, isOptIn: true}, + } + + for _, test := range tests { + providerKeeper.SetTopN(ctx, test.chainID, test.N) + topN, found := providerKeeper.GetTopN(ctx, test.chainID) + require.Equal(t, test.N, topN) + require.True(t, found) + + if test.isOptIn { + require.True(t, providerKeeper.IsOptIn(ctx, test.chainID)) + require.False(t, providerKeeper.IsTopN(ctx, test.chainID)) + } else { + require.False(t, providerKeeper.IsOptIn(ctx, test.chainID)) + require.True(t, providerKeeper.IsTopN(ctx, test.chainID)) + } + } +} + +func TestGetAllOptedIn(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + expectedOptedInValidators := []types.ProviderConsAddress{ + types.NewProviderConsAddress([]byte("providerAddr1")), + types.NewProviderConsAddress([]byte("providerAddr2")), + types.NewProviderConsAddress([]byte("providerAddr3")), + } + + for _, expectedOptedInValidator := range expectedOptedInValidators { + providerKeeper.SetOptedIn(ctx, "chainID", expectedOptedInValidator) + } + + actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, "chainID") + + // sort validators first to be able to compare + sortOptedInValidators := func(addresses []types.ProviderConsAddress) { + sort.Slice(addresses, func(i, j int) bool { + return bytes.Compare(addresses[i].ToSdkConsAddr(), addresses[j].ToSdkConsAddr()) < 0 + }) + } + sortOptedInValidators(expectedOptedInValidators) + sortOptedInValidators(actualOptedInValidators) + require.Equal(t, expectedOptedInValidators, actualOptedInValidators) +} + +// TestOptedIn tests the `SetOptedIn`, `IsOptedIn`, `DeleteOptedIn` and `DeleteAllOptedIn` methods +func TestOptedIn(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + optedInValidator1 := types.NewProviderConsAddress([]byte("providerAddr1")) + optedInValidator2 := types.NewProviderConsAddress([]byte("providerAddr2")) + + require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) + providerKeeper.SetOptedIn(ctx, "chainID", optedInValidator1) + require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) + providerKeeper.DeleteOptedIn(ctx, "chainID", optedInValidator1) + require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) + + providerKeeper.SetOptedIn(ctx, "chainID", optedInValidator1) + providerKeeper.SetOptedIn(ctx, "chainID", optedInValidator2) + require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) + require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator2)) + providerKeeper.DeleteAllOptedIn(ctx, "chainID") + require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator1)) + require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", optedInValidator2)) +} + +// TestConsumerCommissionRate tests the `SetConsumerCommissionRate`, `GetConsumerCommissionRate`, and `DeleteConsumerCommissionRate` methods +func TestConsumerCommissionRate(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) + providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) + + cr, found := providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr1) + require.False(t, found) + require.Equal(t, math.LegacyZeroDec(), cr) + + providerKeeper.SetConsumerCommissionRate(ctx, "chainID", providerAddr1, math.LegacyOneDec()) + cr, found = providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr1) + require.True(t, found) + require.Equal(t, math.LegacyOneDec(), cr) + + providerKeeper.SetConsumerCommissionRate(ctx, "chainID", providerAddr2, math.LegacyZeroDec()) + cr, found = providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr2) + require.True(t, found) + require.Equal(t, math.LegacyZeroDec(), cr) + + provAddrs := providerKeeper.GetAllCommissionRateValidators(ctx, "chainID") + require.Len(t, provAddrs, 2) + + for _, addr := range provAddrs { + providerKeeper.DeleteConsumerCommissionRate(ctx, "chainID", addr) + } + + _, found = providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr1) + require.False(t, found) + + _, found = providerKeeper.GetConsumerCommissionRate(ctx, "chainID", providerAddr2) + require.False(t, found) +} + +// TestValidatorsPowerCap tests the `SetValidatorsPowerCap`, `GetValidatorsPowerCap`, and `DeleteValidatorsPowerCap` methods +func TestValidatorsPowerCap(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + expectedPowerCap := uint32(10) + providerKeeper.SetValidatorsPowerCap(ctx, "chainID", expectedPowerCap) + powerCap, found := providerKeeper.GetValidatorsPowerCap(ctx, "chainID") + require.Equal(t, expectedPowerCap, powerCap) + require.True(t, found) + + providerKeeper.DeleteValidatorsPowerCap(ctx, "chainID") + _, found = providerKeeper.GetValidatorsPowerCap(ctx, "chainID") + require.False(t, found) +} + +// TestValidatorSetCap tests the `SetValidatorSetCap`, `GetValidatorSetCap`, and `DeleteValidatorSetCap` methods +func TestValidatorSetCap(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + expectedPowerCap := uint32(10) + providerKeeper.SetValidatorSetCap(ctx, "chainID", expectedPowerCap) + powerCap, found := providerKeeper.GetValidatorSetCap(ctx, "chainID") + require.Equal(t, expectedPowerCap, powerCap) + require.True(t, found) + + providerKeeper.DeleteValidatorSetCap(ctx, "chainID") + _, found = providerKeeper.GetValidatorSetCap(ctx, "chainID") + require.False(t, found) +} + +// TestAllowlist tests the `SetAllowlist`, `IsAllowlisted`, `DeleteAllowlist`, and `IsAllowlistEmpty` methods +func TestAllowlist(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + // no validator was allowlisted and hence the allowlist is empty + require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + + providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) + providerKeeper.SetAllowlist(ctx, chainID, providerAddr1) + require.True(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr1)) + + // allowlist is not empty anymore + require.False(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + + providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) + providerKeeper.SetAllowlist(ctx, chainID, providerAddr2) + require.True(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr2)) + require.False(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) + + providerKeeper.DeleteAllowlist(ctx, chainID) + require.False(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr1)) + require.False(t, providerKeeper.IsAllowlisted(ctx, chainID, providerAddr2)) + require.True(t, providerKeeper.IsAllowlistEmpty(ctx, chainID)) +} + +// TestDenylist tests the `SetDenylist`, `IsDenylisted`, `DeleteDenylist`, and `IsDenylistEmpty` methods +func TestDenylist(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + // no validator was denylisted and hence the denylist is empty + require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + + providerAddr1 := types.NewProviderConsAddress([]byte("providerAddr1")) + providerKeeper.SetDenylist(ctx, chainID, providerAddr1) + require.True(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr1)) + + // denylist is not empty anymore + require.False(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + + providerAddr2 := types.NewProviderConsAddress([]byte("providerAddr2")) + providerKeeper.SetDenylist(ctx, chainID, providerAddr2) + require.True(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr2)) + require.False(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) + + providerKeeper.DeleteDenylist(ctx, chainID) + require.False(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr1)) + require.False(t, providerKeeper.IsDenylisted(ctx, chainID, providerAddr2)) + require.True(t, providerKeeper.IsDenylistEmpty(ctx, chainID)) +} diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index f68211861b..b7d1f2de0b 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -1,6 +1,7 @@ package keeper import ( + "encoding/base64" "fmt" errorsmod "cosmossdk.io/errors" @@ -15,6 +16,53 @@ import ( ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) +// ParseConsumerKey parses the ED25519 PubKey`consumerKey` from a JSON string +// and constructs its corresponding `tmprotocrypto.PublicKey` +func (k Keeper) ParseConsumerKey(consumerKey string) (tmprotocrypto.PublicKey, error) { + // parse consumer key as long as it's in the right format + pkType, keyStr, err := types.ParseConsumerKeyFromJson(consumerKey) + if err != nil { + return tmprotocrypto.PublicKey{}, err + } + + // Note: the correct way to decide if a key type is supported is to check the + // consensus params. However this functionality was disabled in https://github.com/cosmos/interchain-security/pull/916 + // as a quick way to get ed25519 working, avoiding amino/proto-any marshalling issues. + + // make sure the consumer key type is supported + // cp := ctx.ConsensusParams() + // if cp != nil && cp.Validator != nil { + // if !tmstrings.StringInSlice(pkType, cp.Validator.PubKeyTypes) { + // return nil, errorsmod.Wrapf( + // stakingtypes.ErrValidatorPubKeyTypeNotSupported, + // "got: %s, expected one of: %s", pkType, cp.Validator.PubKeyTypes, + // ) + // } + // } + + // For now, only accept ed25519. + // TODO: decide what types should be supported. + if pkType != "/cosmos.crypto.ed25519.PubKey" { + return tmprotocrypto.PublicKey{}, errorsmod.Wrapf( + stakingtypes.ErrValidatorPubKeyTypeNotSupported, + "got: %s, expected: %s", pkType, "/cosmos.crypto.ed25519.PubKey", + ) + } + + pubKeyBytes, err := base64.StdEncoding.DecodeString(keyStr) + if err != nil { + return tmprotocrypto.PublicKey{}, err + } + + consumerTMPublicKey := tmprotocrypto.PublicKey{ + Sum: &tmprotocrypto.PublicKey_Ed25519{ + Ed25519: pubKeyBytes, + }, + } + + return consumerTMPublicKey, nil +} + // GetValidatorConsumerPubKey returns a validator's public key assigned for a consumer chain func (k Keeper) GetValidatorConsumerPubKey( ctx sdk.Context, @@ -324,12 +372,24 @@ func (k Keeper) AssignConsumerKey( } } - if _, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerAddr); found { + if existingProviderAddr, found := k.GetValidatorByConsumerAddr(ctx, chainID, consumerAddr); found { // consumer key is already in use - // prevent multiple validators from assigning the same key - return errorsmod.Wrapf( - types.ErrConsumerKeyInUse, "a validator has assigned the consumer key already", - ) + if providerAddr.Address.Equals(existingProviderAddr.Address) { + // the validator itself is the one already using the consumer key, + // just do a noop + k.Logger(ctx).Info("tried to assign a consumer key that is already assigned to the validator", + "consumer chainID", chainID, + "validator", providerAddr.String(), + "consumer consensus addr", consumerAddr.String(), + ) + return nil + } else { + // the validators are different -> throw an error to + // prevent multiple validators from assigning the same key + return errorsmod.Wrapf( + types.ErrConsumerKeyInUse, "a validator has assigned the consumer key already", + ) + } } // get the previous key assigned for this validator on this consumer chain diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index dc0faf52d4..2f67890b00 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -641,6 +641,7 @@ type Assignment struct { // of simulated scenarios where random key assignments and validator // set updates are generated. func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { + CHAINID := ChainID // The number of full test executions to run NUM_EXECUTIONS := 100 // Each test execution mimics the adding of a consumer chain and the @@ -768,9 +769,12 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { }) } - nextValidators := k.ComputeNextEpochConsumerValSet(ctx, ChainID, bondedValidators) - updates = providerkeeper.DiffValidators(k.GetConsumerValSet(ctx, ChainID), nextValidators) - k.SetConsumerValSet(ctx, ChainID, nextValidators) + nextValidators := k.FilterValidators(ctx, CHAINID, bondedValidators, + func(providerAddr types.ProviderConsAddress) bool { + return true + }) + updates = providerkeeper.DiffValidators(k.GetConsumerValSet(ctx, CHAINID), nextValidators) + k.SetConsumerValSet(ctx, CHAINID, nextValidators) consumerValset.apply(updates) // Simulate the VSCID update in EndBlock diff --git a/x/ccv/provider/keeper/legacy_proposal.go b/x/ccv/provider/keeper/legacy_proposal.go index a5391ceff3..93bff62787 100644 --- a/x/ccv/provider/keeper/legacy_proposal.go +++ b/x/ccv/provider/keeper/legacy_proposal.go @@ -1,6 +1,7 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" @@ -81,3 +82,36 @@ func (k Keeper) HandleLegacyConsumerRemovalProposal(ctx sdk.Context, p *types.Co return nil } + +// HandleConsumerModificationProposal modifies a running consumer chain +func (k Keeper) HandleLegacyConsumerModificationProposal(ctx sdk.Context, p *types.ConsumerModificationProposal) error { + if _, found := k.GetConsumerClientId(ctx, p.ChainId); !found { + return errorsmod.Wrapf(types.ErrInvalidConsumerChainID, "consumer %s chain is not running", p.ChainId) + } + + k.SetTopN(ctx, p.ChainId, p.Top_N) + k.SetValidatorsPowerCap(ctx, p.ChainId, p.ValidatorsPowerCap) + k.SetValidatorSetCap(ctx, p.ChainId, p.ValidatorSetCap) + + k.DeleteAllowlist(ctx, p.ChainId) + for _, address := range p.Allowlist { + consAddr, err := sdk.ConsAddressFromBech32(address) + if err != nil { + continue + } + + k.SetAllowlist(ctx, p.ChainId, types.NewProviderConsAddress(consAddr)) + } + + k.DeleteDenylist(ctx, p.ChainId) + for _, address := range p.Denylist { + consAddr, err := sdk.ConsAddressFromBech32(address) + if err != nil { + continue + } + + k.SetDenylist(ctx, p.ChainId, types.NewProviderConsAddress(consAddr)) + } + + return nil +} diff --git a/x/ccv/provider/keeper/legacy_proposal_test.go b/x/ccv/provider/keeper/legacy_proposal_test.go index bc7abbc0c6..48f370f5fc 100644 --- a/x/ccv/provider/keeper/legacy_proposal_test.go +++ b/x/ccv/provider/keeper/legacy_proposal_test.go @@ -56,6 +56,11 @@ func TestHandleLegacyConsumerAdditionProposal(t *testing.T) { 100000000000, 100000000000, 100000000000, + 0, + 0, + 0, + nil, + nil, ).(*providertypes.ConsumerAdditionProposal), blockTime: now, expAppendProp: true, @@ -81,6 +86,11 @@ func TestHandleLegacyConsumerAdditionProposal(t *testing.T) { 100000000000, 100000000000, 100000000000, + 0, + 0, + 0, + nil, + nil, ).(*providertypes.ConsumerAdditionProposal), blockTime: now, expAppendProp: false, @@ -96,6 +106,7 @@ func TestHandleLegacyConsumerAdditionProposal(t *testing.T) { if tc.expAppendProp { // Mock calls are only asserted if we expect a client to be created. + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(1) gomock.InOrder( testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, tc.prop.ChainId, clienttypes.NewHeight(2, 3))..., ) @@ -223,8 +234,7 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { // meaning no external keeper methods are allowed to be called. if tc.expAppendProp { testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) - - // assert mocks for expected calls to `StopConsumerChain` when closing the underlying channel + // Valid client creation is asserted with mock expectations here gomock.InOrder(testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) } @@ -254,3 +264,52 @@ func TestHandleLegacyConsumerRemovalProposal(t *testing.T) { ctrl.Finish() } } + +func TestHandleConsumerModificationProposal(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + // set up a consumer client, so it seems that "chainID" is running + providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + + // set PSS-related fields to update them later on + providerKeeper.SetTopN(ctx, chainID, 50) + providerKeeper.SetValidatorSetCap(ctx, chainID, 10) + providerKeeper.SetValidatorsPowerCap(ctx, chainID, 34) + providerKeeper.SetAllowlist(ctx, chainID, providertypes.NewProviderConsAddress([]byte("allowlistedAddr1"))) + providerKeeper.SetAllowlist(ctx, chainID, providertypes.NewProviderConsAddress([]byte("allowlistedAddr2"))) + providerKeeper.SetDenylist(ctx, chainID, providertypes.NewProviderConsAddress([]byte("denylistedAddr1"))) + + expectedTopN := uint32(75) + expectedValidatorsPowerCap := uint32(67) + expectedValidatorSetCap := uint32(20) + expectedAllowlistedValidator := "cosmosvalcons1wpex7anfv3jhystyv3eq20r35a" + expectedDenylistedValidator := "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39" + proposal := providertypes.NewConsumerModificationProposal("title", "description", chainID, + expectedTopN, + expectedValidatorsPowerCap, + expectedValidatorSetCap, + []string{expectedAllowlistedValidator}, + []string{expectedDenylistedValidator}, + ).(*providertypes.ConsumerModificationProposal) + + err := providerKeeper.HandleLegacyConsumerModificationProposal(ctx, proposal) + require.NoError(t, err) + + actualTopN, _ := providerKeeper.GetTopN(ctx, chainID) + require.Equal(t, expectedTopN, actualTopN) + actualValidatorsPowerCap, _ := providerKeeper.GetValidatorsPowerCap(ctx, chainID) + require.Equal(t, expectedValidatorsPowerCap, actualValidatorsPowerCap) + actualValidatorSetCap, _ := providerKeeper.GetValidatorSetCap(ctx, chainID) + require.Equal(t, expectedValidatorSetCap, actualValidatorSetCap) + + allowlistedValidator, err := sdk.ConsAddressFromBech32(expectedAllowlistedValidator) + require.Equal(t, 1, len(providerKeeper.GetAllowList(ctx, chainID))) + require.Equal(t, providertypes.NewProviderConsAddress(allowlistedValidator), providerKeeper.GetAllowList(ctx, chainID)[0]) + + denylistedValidator, err := sdk.ConsAddressFromBech32(expectedDenylistedValidator) + require.Equal(t, 1, len(providerKeeper.GetDenyList(ctx, chainID))) + require.Equal(t, providertypes.NewProviderConsAddress(denylistedValidator), providerKeeper.GetDenyList(ctx, chainID)[0]) +} diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index 0a5ba95368..fd3d76a770 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "encoding/base64" errorsmod "cosmossdk.io/errors" @@ -11,7 +10,6 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" @@ -60,47 +58,11 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign return nil, err } - // parse consumer key as long as it's in the right format - pkType, keyStr, err := types.ParseConsumerKeyFromJson(msg.ConsumerKey) + consumerTMPublicKey, err := k.ParseConsumerKey(msg.ConsumerKey) if err != nil { return nil, err } - // Note: the correct way to decide if a key type is supported is to check the - // consensus params. However this functionality was disabled in https://github.com/cosmos/interchain-security/pull/916 - // as a quick way to get ed25519 working, avoiding amino/proto-any marshalling issues. - - // make sure the consumer key type is supported - // cp := ctx.ConsensusParams() - // if cp != nil && cp.Validator != nil { - // if !tmstrings.StringInSlice(pkType, cp.Validator.PubKeyTypes) { - // return nil, errorsmod.Wrapf( - // stakingtypes.ErrValidatorPubKeyTypeNotSupported, - // "got: %s, expected one of: %s", pkType, cp.Validator.PubKeyTypes, - // ) - // } - // } - - // For now, only accept ed25519. - // TODO: decide what types should be supported. - if pkType != "/cosmos.crypto.ed25519.PubKey" { - return nil, errorsmod.Wrapf( - stakingtypes.ErrValidatorPubKeyTypeNotSupported, - "got: %s, expected: %s", pkType, "/cosmos.crypto.ed25519.PubKey", - ) - } - - pubKeyBytes, err := base64.StdEncoding.DecodeString(keyStr) - if err != nil { - return nil, err - } - - consumerTMPublicKey := tmprotocrypto.PublicKey{ - Sum: &tmprotocrypto.PublicKey_Ed25519{ - Ed25519: pubKeyBytes, - }, - } - if err := k.Keeper.AssignConsumerKey(ctx, msg.ChainId, validator, consumerTMPublicKey); err != nil { return nil, err } @@ -235,3 +197,123 @@ func (k msgServer) SubmitConsumerDoubleVoting(goCtx context.Context, msg *types. return &types.MsgSubmitConsumerDoubleVotingResponse{}, nil } + +func (k msgServer) OptIn(goCtx context.Context, msg *types.MsgOptIn) (*types.MsgOptInResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + valAddress, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + return nil, err + } + + // validator must already be registered + validator, err := k.stakingKeeper.GetValidator(ctx, valAddress) + if err != nil { + return nil, err + } + + consAddrTmp, err := validator.GetConsAddr() + if err != nil { + return nil, err + } + providerConsAddr := types.NewProviderConsAddress(consAddrTmp) + + err = k.Keeper.HandleOptIn(ctx, msg.ChainId, providerConsAddr, msg.ConsumerKey) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeOptIn, + sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), + sdk.NewAttribute(types.AttributeConsumerConsensusPubKey, msg.ConsumerKey), + ), + }) + + return &types.MsgOptInResponse{}, nil +} + +func (k msgServer) OptOut(goCtx context.Context, msg *types.MsgOptOut) (*types.MsgOptOutResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + valAddress, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + return nil, err + } + + // validator must already be registered + validator, err := k.stakingKeeper.GetValidator(ctx, valAddress) + if err != nil { + return nil, err + } + + consAddrTmp, err := validator.GetConsAddr() + if err != nil { + return nil, err + } + providerConsAddr := types.NewProviderConsAddress(consAddrTmp) + + err = k.Keeper.HandleOptOut(ctx, msg.ChainId, providerConsAddr) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeOptOut, + sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), + ), + }) + + return &types.MsgOptOutResponse{}, nil +} + +func (k msgServer) SetConsumerCommissionRate(goCtx context.Context, msg *types.MsgSetConsumerCommissionRate) (*types.MsgSetConsumerCommissionRateResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + providerValidatorAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + return nil, err + } + + // validator must already be registered + validator, err := k.stakingKeeper.GetValidator(ctx, providerValidatorAddr) + if err != nil { + return nil, stakingtypes.ErrNoValidatorFound + } + + consAddr, err := validator.GetConsAddr() + if err != nil { + return nil, err + } + + if err := k.HandleSetConsumerCommissionRate(ctx, msg.ChainId, types.NewProviderConsAddress(consAddr), msg.Rate); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeSetConsumerCommissionRate, + sdk.NewAttribute(types.AttributeConsumerChainID, msg.ChainId), + sdk.NewAttribute(types.AttributeProviderValidatorAddress, msg.ProviderAddr), + sdk.NewAttribute(types.AttributeConsumerCommissionRate, msg.Rate.String()), + ), + }) + + return &types.MsgSetConsumerCommissionRateResponse{}, nil +} + +func (k msgServer) ConsumerModification(goCtx context.Context, msg *types.MsgConsumerModification) (*types.MsgConsumerModificationResponse, error) { + if k.GetAuthority() != msg.Authority { + return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + err := k.Keeper.HandleConsumerModificationProposal(ctx, msg) + if err != nil { + return nil, errorsmod.Wrapf(err, "failed handling ConsumerAddition proposal") + } + + return &types.MsgConsumerModificationResponse{}, nil +} diff --git a/x/ccv/provider/keeper/partial_set_security.go b/x/ccv/provider/keeper/partial_set_security.go new file mode 100644 index 0000000000..1edff9b56b --- /dev/null +++ b/x/ccv/provider/keeper/partial_set_security.go @@ -0,0 +1,327 @@ +package keeper + +import ( + "fmt" + "sort" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +// HandleOptIn prepares validator `providerAddr` to opt in to `chainID` with an optional `consumerKey` consumer public key. +// Note that the validator only opts in at the end of an epoch. +func (k Keeper) HandleOptIn(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, consumerKey string) error { + if !k.IsConsumerProposedOrRegistered(ctx, chainID) { + return errorsmod.Wrapf( + types.ErrUnknownConsumerChainId, + "opting in to an unknown consumer chain, with id: %s", chainID) + } + + k.SetOptedIn(ctx, chainID, providerAddr) + + if consumerKey != "" { + consumerTMPublicKey, err := k.ParseConsumerKey(consumerKey) + if err != nil { + return err + } + + validator, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerAddr.Address) + if err != nil { + return err + } + + err = k.AssignConsumerKey(ctx, chainID, validator, consumerTMPublicKey) + if err != nil { + return err + } + } + + return nil +} + +// HandleOptOut prepares validator `providerAddr` to opt out from running `chainID`. +// Note that the validator only opts out at the end of an epoch. +func (k Keeper) HandleOptOut(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) error { + if _, found := k.GetConsumerClientId(ctx, chainID); !found { + // A validator can only opt out from a running chain. We check this by checking the consumer client id, because + // `SetConsumerClientId` is set when the chain starts in `CreateConsumerClientInCachedCtx` of `BeginBlockInit`. + return errorsmod.Wrapf( + types.ErrUnknownConsumerChainId, + "opting out of an unknown or not running consumer chain, with id: %s", chainID) + } + + if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { + // a validator cannot opt out from a Top N chain if the validator is in the Top N validators + validator, err := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerAddr.ToSdkConsAddr()) + if err != nil { + return err + } + valAddr, err := sdk.ValAddressFromBech32(validator.GetOperator()) + if err != nil { + return err + } + power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) + if err != nil { + return err + } + lastVals, err := k.stakingKeeper.GetLastValidators(ctx) + if err != nil { + return err + } + minPowerToOptIn, err := k.ComputeMinPowerToOptIn(ctx, lastVals, topN) + if err != nil { + k.Logger(ctx).Error("failed to compute min power to opt in for chain", "chain", chainID, "error", err) + return errorsmod.Wrapf( + types.ErrCannotOptOutFromTopN, + "validator with power (%d) cannot opt out from Top N chain (%s) because the min power"+ + " could not be computed: %s", power, chainID, err.Error()) + + } + + if power >= minPowerToOptIn { + return errorsmod.Wrapf( + types.ErrCannotOptOutFromTopN, + "validator with power (%d) cannot opt out from Top N chain (%s) because all validators"+ + " with at least %d power have to validate", power, chainID, minPowerToOptIn) + } + } + + k.DeleteOptedIn(ctx, chainID, providerAddr) + return nil +} + +// OptInTopNValidators opts in to `chainID` all the `bondedValidators` that have at least `minPowerToOptIn` power +func (k Keeper) OptInTopNValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator, minPowerToOptIn int64) { + for _, val := range bondedValidators { + valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) + if err != nil { + k.Logger(ctx).Error("could not retrieve validator address: %s: %s", + val.GetOperator(), err) + continue + } + power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) + if err != nil { + k.Logger(ctx).Error("could not retrieve last power of validator address: %s: %s", + val.GetOperator(), err) + continue + } + if power >= minPowerToOptIn { + consAddr, err := val.GetConsAddr() + if err != nil { + k.Logger(ctx).Error("could not retrieve validators consensus address: %s: %s", + val, err) + continue + } + + // if validator already exists it gets overwritten + k.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(consAddr)) + } // else validators that do not belong to the top N validators but were opted in, remain opted in + } +} + +// ComputeMinPowerToOptIn returns the minimum power needed for a validator (from the bonded validators) +// to belong to the `topN` validators for a Top N chain. +func (k Keeper) ComputeMinPowerToOptIn(ctx sdk.Context, bondedValidators []stakingtypes.Validator, topN uint32) (int64, error) { + if topN == 0 || topN > 100 { + // Note that Top N chains have a lower limit on `topN`, namely that topN cannot be less than 50. + // However, we can envision that this method could be used for other (future) reasons where this might not + // be the case. For this, this method operates for `topN`s in (0, 100]. + return 0, fmt.Errorf("trying to compute minimum power with an incorrect"+ + " topN value (%d). topN has to be in (0, 100]", topN) + } + + totalPower := math.LegacyZeroDec() + var powers []int64 + + for _, val := range bondedValidators { + valAddr, err := sdk.ValAddressFromBech32(val.GetOperator()) + if err != nil { + return 0, err + } + power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) + if err != nil { + return 0, err + } + powers = append(powers, power) + totalPower = totalPower.Add(math.LegacyNewDec(power)) + } + + // sort by powers descending + sort.Slice(powers, func(i, j int) bool { + return powers[i] > powers[j] + }) + + topNThreshold := math.LegacyNewDec(int64(topN)).QuoInt64(int64(100)) + powerSum := math.LegacyZeroDec() + for _, power := range powers { + powerSum = powerSum.Add(math.LegacyNewDec(power)) + if powerSum.Quo(totalPower).GTE(topNThreshold) { + return power, nil + } + } + + // We should never reach this point because the topN can be up to 1.0 (100%) and in the above `for` loop we + // perform an equal comparison as well (`GTE`). + return 0, fmt.Errorf("should never reach this point with topN (%d), totalPower (%d), and powerSum (%d)", topN, totalPower, powerSum) +} + +// CapValidatorSet caps the provided `validators` if chain `chainID` is an Opt In chain with a validator-set cap. If cap +// is `k`, `CapValidatorSet` returns the first `k` validators from `validators` with the highest power. +func (k Keeper) CapValidatorSet(ctx sdk.Context, chainID string, validators []types.ConsumerValidator) []types.ConsumerValidator { + if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { + // is a no-op if the chain is a Top N chain + return validators + } + + if validatorSetCap, found := k.GetValidatorSetCap(ctx, chainID); found && validatorSetCap != 0 && int(validatorSetCap) < len(validators) { + sort.Slice(validators, func(i, j int) bool { + return validators[i].Power > validators[j].Power + }) + + return validators[:int(validatorSetCap)] + } else { + return validators + } +} + +// CapValidatorsPower caps the power of the validators on chain `chainID` and returns an updated slice of validators +// with their new powers. Works on a best-basis effort because there are cases where we cannot guarantee that all validators +// on the consumer chain have less power than the set validators-power cap. For example, if we have 10 validators and +// the power cap is set to 5%, we need at least one validator to have more than 10% of the voting power on the consumer chain. +func (k Keeper) CapValidatorsPower(ctx sdk.Context, chainID string, validators []types.ConsumerValidator) []types.ConsumerValidator { + if p, found := k.GetValidatorsPowerCap(ctx, chainID); found && p > 0 { + return NoMoreThanPercentOfTheSum(validators, p) + } else { + // is a no-op if power cap is not set for `chainID` + return validators + } +} + +// sum is a helper function to sum all the validators' power +func sum(validators []types.ConsumerValidator) int64 { + s := int64(0) + for _, v := range validators { + s = s + v.Power + } + return s +} + +// NoMoreThanPercentOfTheSum returns a set of validators with updated powers such that no validator has more than the +// provided `percent` of the sum of all validators' powers. Operates on a best-effort basis. +func NoMoreThanPercentOfTheSum(validators []types.ConsumerValidator, percent uint32) []types.ConsumerValidator { + // Algorithm's idea + // ---------------- + // Consider the validators' powers to be `a_1, a_2, ... a_n` and `p` to be the percent in [1, 100]. Now, consider + // the sum `s = a_1 + a_2 + ... + a_n`. Then `maxPower = s * p / 100 <=> 100 * maxPower = s * p`. + // The problem of capping the validators' powers to be no more than `p` has no solution if `(100 / n) > p`. For example, + // for n = 10 and p = 5 we do not have a solution. We would need at least one validator with power greater than 10% + // for a solution to exist. + // So, if `(100 / n) > p` there's no solution. We know that `100 * maxPower = s * p` and so `(100 / n) > (100 * maxPower) / s` + // `100 * s > 100 * maxPower * n <=> s > maxPower * n`. Thus, we do not have a solution if `s > n * maxPower`. + + // If `s <= n * maxPower` the idea of the algorithm is rather simple. + // - Compute the `maxPower` a validator must have so that it does not have more than `percent` of the voting power. + // - If a validator `v` has power `p`, then: + // - if `p > maxPower` we set `v`'s power to `maxPower` and distribute the `p - maxPower` to validators that + // have less than `maxPower` power. This way, the total sum remains the same and no validator has more than + // `maxPower` and so the power capping is satisfied. + // - Note that in order to avoid setting multiple validators to `maxPower`, we first compute all the `remainingPower` + // we have to distribute and then attempt to add `remainingPower / validatorsWithPowerLessThanMaxPower` to each validator. + // To guarantee that the sum remains the same after the distribution of powers, we sort the powers in descending + // order. This way, we first attempt to add `remainingPower / validatorsWithPowerLessThanMaxPower` to validators + // with greater power and if we cannot add the `remainingPower / validatorsWithPowerLessThanMaxPower` without + // exceeding `maxPower`, we just add enough to reach `maxPower` and add the remaining power to validators with smaller + // power. + + // If `s > n * maxPower` there's no solution and the algorithm would set everything to `maxPower`. + // ---------------- + + // Computes `floor((sum(validators) * percent) / 100)` + maxPower := math.LegacyNewDec(sum(validators)).Mul(math.LegacyNewDec(int64(percent))).QuoInt64(100).TruncateInt64() + + if maxPower == 0 { + // edge case: set `maxPower` to 1 to avoid setting the power of a validator to 0 + maxPower = 1 + } + + // Sort by `.Power` in decreasing order. Sorting in descending order is needed because otherwise we would have cases + // like this `powers =[60, 138, 559]` and `p = 35%` where sum is `757` and `maxValue = 264`. + // Because `559 - 264 = 295` we have to distribute 295 to the first 2 numbers (`295/2 = 147` to each number). However, + // note that `138 + 147 > 264`. If we were to add 147 to 60 first, then we cannot give the remaining 147 to 138. + // So, the idea is to first give `126 (= 264 - 138)` to 138, so it becomes 264, and then add `21 (=147 - 26) + 147` to 60. + sort.Slice(validators, func(i, j int) bool { + return validators[i].Power > validators[j].Power + }) + + // `remainingPower` is to be distributed to validators that have power less than `maxPower` + remainingPower := int64(0) + validatorsWithPowerLessThanMaxPower := 0 + for _, v := range validators { + if v.Power >= maxPower { + remainingPower = remainingPower + (v.Power - maxPower) + } else { + validatorsWithPowerLessThanMaxPower++ + } + } + + updatedValidators := make([]types.ConsumerValidator, len(validators)) + + powerPerValidator := int64(0) + remainingValidators := int64(validatorsWithPowerLessThanMaxPower) + if remainingValidators != 0 { + // power to give to each validator in order to distribute the `remainingPower` + powerPerValidator = remainingPower / remainingValidators + } + + for i, v := range validators { + if v.Power >= maxPower { + updatedValidators[i] = validators[i] + updatedValidators[i].Power = maxPower + } else if v.Power+powerPerValidator >= maxPower { + updatedValidators[i] = validators[i] + updatedValidators[i].Power = maxPower + remainingPower = remainingPower - (maxPower - v.Power) + remainingValidators-- + } else { + updatedValidators[i] = validators[i] + updatedValidators[i].Power = v.Power + powerPerValidator + remainingPower = remainingPower - (updatedValidators[i].Power - validators[i].Power) + remainingValidators-- + } + if remainingValidators == 0 { + continue + } + powerPerValidator = remainingPower / remainingValidators + } + + return updatedValidators +} + +// CanValidateChain returns true if the validator `providerAddr` is opted-in to chain `chainID` and the allowlist and +// denylist do not prevent the validator from validating the chain. +func (k Keeper) CanValidateChain(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) bool { + // only consider opted-in validators + return k.IsOptedIn(ctx, chainID, providerAddr) && + // if an allowlist is declared, only consider allowlisted validators + (k.IsAllowlistEmpty(ctx, chainID) || + k.IsAllowlisted(ctx, chainID, providerAddr)) && + // if a denylist is declared, only consider denylisted validators + (k.IsDenylistEmpty(ctx, chainID) || + !k.IsDenylisted(ctx, chainID, providerAddr)) +} + +// ComputeNextValidators computes the validators for the upcoming epoch based on the currently `bondedValidators`. +func (k Keeper) ComputeNextValidators(ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator) []types.ConsumerValidator { + nextValidators := k.FilterValidators(ctx, chainID, bondedValidators, + func(providerAddr types.ProviderConsAddress) bool { + return k.CanValidateChain(ctx, chainID, providerAddr) + }) + + nextValidators = k.CapValidatorSet(ctx, chainID, nextValidators) + return k.CapValidatorsPower(ctx, chainID, nextValidators) +} diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go new file mode 100644 index 0000000000..0cf67d9dc3 --- /dev/null +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -0,0 +1,679 @@ +package keeper_test + +import ( + "bytes" + "sort" + "testing" + + gomath "math" + + "cosmossdk.io/math" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "pgregory.net/rapid" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/cometbft/cometbft/proto/tendermint/crypto" + + testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" +) + +func TestHandleOptIn(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) + + // trying to opt in to a non-proposed and non-registered chain returns an error + require.Error(t, providerKeeper.HandleOptIn(ctx, "unknownChainID", providerAddr, "")) + + providerKeeper.SetProposedConsumerChain(ctx, "chainID", 1) + require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", providerAddr)) + providerKeeper.HandleOptIn(ctx, "chainID", providerAddr, "") + require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", providerAddr)) +} + +func TestHandleOptInWithConsumerKey(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // generate a consensus public key for the provider + providerConsPubKey := ed25519.GenPrivKeyFromSecret([]byte{1}).PubKey() + consAddr := sdk.ConsAddress(providerConsPubKey.Address()) + providerAddr := types.NewProviderConsAddress(consAddr) + + calls := []*gomock.Call{ + mocks.MockStakingKeeper.EXPECT(). + GetValidatorByConsAddr(gomock.Any(), gomock.Any()). + DoAndReturn(func(ctx sdk.Context, addr sdk.ConsAddress) (stakingtypes.Validator, error) { + if addr.Equals(providerAddr.Address) { + // Given `providerAddr`, `GetValidatorByConsAddr` returns a validator with the + // exact same `ConsensusPubkey` + pkAny, _ := codectypes.NewAnyWithValue(providerConsPubKey) + return stakingtypes.Validator{ConsensusPubkey: pkAny}, nil + } else { + // for any other consensus address, we cannot find a validator + return stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound + } + }).Times(2), + } + + gomock.InOrder(calls...) + providerKeeper.SetProposedConsumerChain(ctx, "chainID", 1) + + // create a sample consumer key to assign to the `providerAddr` validator + // on the consumer chain with id `chainID` + consumerKey := "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}" + expectedConsumerPubKey, err := providerKeeper.ParseConsumerKey(consumerKey) + require.NoError(t, err) + + err = providerKeeper.HandleOptIn(ctx, "chainID", providerAddr, consumerKey) + require.NoError(t, err) + + // assert that the consumeKey was assigned to `providerAddr` validator on chain with id `chainID` + actualConsumerPubKey, found := providerKeeper.GetValidatorConsumerPubKey(ctx, "chainID", providerAddr) + require.True(t, found) + require.Equal(t, expectedConsumerPubKey, actualConsumerPubKey) + + // assert that the `consumerAddr` to `providerAddr` association was set as well + consumerAddr, _ := ccvtypes.TMCryptoPublicKeyToConsAddr(actualConsumerPubKey) + actualProviderConsAddr, found := providerKeeper.GetValidatorByConsumerAddr(ctx, "chainID", types.NewConsumerConsAddress(consumerAddr)) + require.Equal(t, providerAddr, actualProviderConsAddr) +} + +func TestHandleOptOut(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) + + // trying to opt out from a not running chain returns an error + require.Error(t, providerKeeper.HandleOptOut(ctx, "unknownChainID", providerAddr)) + + // set a consumer client so that the chain is considered running + providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + + // if validator (`providerAddr`) is already opted in, then an opt-out would remove this validator + providerKeeper.SetOptedIn(ctx, "chainID", providerAddr) + require.True(t, providerKeeper.IsOptedIn(ctx, "chainID", providerAddr)) + providerKeeper.HandleOptOut(ctx, "chainID", providerAddr) + require.False(t, providerKeeper.IsOptedIn(ctx, "chainID", providerAddr)) +} + +func TestHandleOptOutFromTopNChain(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + // set a consumer client so that the chain is considered running + providerKeeper.SetConsumerClientId(ctx, chainID, "clientID") + + // set the chain as Top 50 and create 4 validators with 10%, 20%, 30%, and 40% of the total voting power + // respectively + providerKeeper.SetTopN(ctx, "chainID", 50) + valA := createStakingValidator(ctx, mocks, 1, 1, 1) // 10% of the total voting power (can opt out) + valAConsAddr, _ := valA.GetConsAddr() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valAConsAddr).Return(valA, nil).AnyTimes() + valB := createStakingValidator(ctx, mocks, 2, 2, 2) // 20% of the total voting power (can opt out) + valBConsAddr, _ := valB.GetConsAddr() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valBConsAddr).Return(valB, nil).AnyTimes() + valC := createStakingValidator(ctx, mocks, 3, 3, 3) // 30% of the total voting power (cannot opt out) + valCConsAddr, _ := valC.GetConsAddr() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valCConsAddr).Return(valC, nil).AnyTimes() + valD := createStakingValidator(ctx, mocks, 4, 4, 4) // 40% of the total voting power (cannot opt out) + valDConsAddr, _ := valD.GetConsAddr() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valDConsAddr).Return(valD, nil).AnyTimes() + + mocks.MockStakingKeeper.EXPECT().GetLastValidators(ctx).Return([]stakingtypes.Validator{valA, valB, valC, valD}, nil).AnyTimes() + + // opt in all validators + providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valDConsAddr)) + + // validators A and B can opt out because they belong the bottom 30% of validators + require.NoError(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(valAConsAddr))) + require.NoError(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(valBConsAddr))) + + // validators C and D cannot opt out because C has 30% of the voting power and D has 40% of the voting power + // and hence both are needed to keep validating a Top 50 chain + require.Error(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(valCConsAddr))) + require.Error(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(valDConsAddr))) + + // opting out a validator that cannot be found from a Top N chain should also return an error + notFoundValidator := createStakingValidator(ctx, mocks, 5, 5, 5) + notFoundValidatorConsAddr, _ := notFoundValidator.GetConsAddr() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, notFoundValidatorConsAddr). + Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound) + require.Error(t, providerKeeper.HandleOptOut(ctx, chainID, types.NewProviderConsAddress(notFoundValidatorConsAddr))) +} + +func TestHandleSetConsumerCommissionRate(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerAddr := types.NewProviderConsAddress([]byte("providerAddr")) + + // trying to set a commission rate to a unknown consumer chain + require.Error(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, "unknownChainID", providerAddr, math.LegacyZeroDec())) + + // setup a pending consumer chain + chainID := "pendingChainID" + providerKeeper.SetPendingConsumerAdditionProp(ctx, &types.ConsumerAdditionProposal{ChainId: chainID}) + + // check that there's no commission rate set for the validator yet + _, found := providerKeeper.GetConsumerCommissionRate(ctx, chainID, providerAddr) + require.False(t, found) + + mocks.MockStakingKeeper.EXPECT().MinCommissionRate(ctx).Return(math.LegacyZeroDec(), nil).Times(1) + require.NoError(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, chainID, providerAddr, math.LegacyOneDec())) + + // check that the commission rate is now set + cr, found := providerKeeper.GetConsumerCommissionRate(ctx, chainID, providerAddr) + require.Equal(t, math.LegacyOneDec(), cr) + require.True(t, found) + + // set minimum rate of 1/2 + commissionRate := math.LegacyNewDec(1).Quo(math.LegacyNewDec(2)) + mocks.MockStakingKeeper.EXPECT().MinCommissionRate(ctx).Return(commissionRate, nil).AnyTimes() + + // try to set a rate slightly below the minimum + require.Error(t, providerKeeper.HandleSetConsumerCommissionRate( + ctx, + chainID, + providerAddr, + commissionRate.Sub(math.LegacyNewDec(1).Quo(math.LegacyNewDec(100)))), // 0.5 - 0.01 + "commission rate should be rejected (below min), but is not", + ) + + // set a valid commission equal to the minimum + require.NoError(t, providerKeeper.HandleSetConsumerCommissionRate(ctx, chainID, providerAddr, commissionRate)) + // check that the rate was set + cr, found = providerKeeper.GetConsumerCommissionRate(ctx, chainID, providerAddr) + require.Equal(t, commissionRate, cr) + require.True(t, found) +} + +func TestOptInTopNValidators(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // create 4 validators with powers 1, 2, 3, and 1 respectively + valA := createStakingValidator(ctx, mocks, 1, 1, 1) + valAConsAddr, _ := valA.GetConsAddr() + valB := createStakingValidator(ctx, mocks, 2, 2, 2) + valBConsAddr, _ := valB.GetConsAddr() + valC := createStakingValidator(ctx, mocks, 3, 3, 3) + valCConsAddr, _ := valC.GetConsAddr() + valD := createStakingValidator(ctx, mocks, 4, 1, 4) + valDConsAddr, _ := valD.GetConsAddr() + + // Start Test 1: opt in all validators with power >= 0 + providerKeeper.OptInTopNValidators(ctx, "chainID", []stakingtypes.Validator{valA, valB, valC, valD}, 0) + expectedOptedInValidators := []types.ProviderConsAddress{ + types.NewProviderConsAddress(valAConsAddr), + types.NewProviderConsAddress(valBConsAddr), + types.NewProviderConsAddress(valCConsAddr), + types.NewProviderConsAddress(valDConsAddr), + } + actualOptedInValidators := providerKeeper.GetAllOptedIn(ctx, "chainID") + + // sort validators first to be able to compare + sortUpdates := func(addresses []types.ProviderConsAddress) { + sort.Slice(addresses, func(i, j int) bool { + return bytes.Compare(addresses[i].ToSdkConsAddr(), addresses[j].ToSdkConsAddr()) < 0 + }) + } + + sortUpdates(expectedOptedInValidators) + sortUpdates(actualOptedInValidators) + require.Equal(t, expectedOptedInValidators, actualOptedInValidators) + + // reset state for the upcoming checks + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valDConsAddr)) + + // Start Test 2: opt in all validators with power >= 1 + // We expect the same `expectedOptedInValidators` as when we opted in all validators with power >= 0 because the + // validators with the smallest power have power == 1 + providerKeeper.OptInTopNValidators(ctx, "chainID", []stakingtypes.Validator{valA, valB, valC, valD}, 0) + actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, "chainID") + sortUpdates(actualOptedInValidators) + require.Equal(t, expectedOptedInValidators, actualOptedInValidators) + + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valDConsAddr)) + + // Start Test 3: opt in all validators with power >= 2 and hence we do not expect to opt in validator A + providerKeeper.OptInTopNValidators(ctx, "chainID", []stakingtypes.Validator{valA, valB, valC, valD}, 2) + expectedOptedInValidators = []types.ProviderConsAddress{ + types.NewProviderConsAddress(valBConsAddr), + types.NewProviderConsAddress(valCConsAddr), + } + actualOptedInValidators = providerKeeper.GetAllOptedIn(ctx, "chainID") + + // sort validators first to be able to compare + sortUpdates(expectedOptedInValidators) + sortUpdates(actualOptedInValidators) + require.Equal(t, expectedOptedInValidators, actualOptedInValidators) + + // reset state for the upcoming checks + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valBConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valCConsAddr)) + providerKeeper.DeleteOptedIn(ctx, "chainID", types.NewProviderConsAddress(valDConsAddr)) + + // Start Test 4: opt in all validators with power >= 4 and hence we do not expect any opted-in validators + providerKeeper.OptInTopNValidators(ctx, "chainID", []stakingtypes.Validator{valA, valB, valC, valD}, 4) + require.Empty(t, providerKeeper.GetAllOptedIn(ctx, "chainID")) +} + +func TestComputeMinPowerToOptIn(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // create 5 validators with powers 1, 3, 5, 6, 10 (not in that order) with total power of 25 (= 1 + 3 + 5 + 6 + 10) + // such that: + // validator power => cumulative share + // 10 => 40% + // 6 => 64% + // 5 => 84% + // 3 => 96% + // 1 => 100% + + bondedValidators := []stakingtypes.Validator{ + createStakingValidator(ctx, mocks, 1, 5, 1), + createStakingValidator(ctx, mocks, 2, 10, 2), + createStakingValidator(ctx, mocks, 3, 3, 3), + createStakingValidator(ctx, mocks, 4, 1, 4), + createStakingValidator(ctx, mocks, 5, 6, 5), + } + + m, err := providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 100) + require.NoError(t, err) + require.Equal(t, int64(1), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 97) + require.NoError(t, err) + require.Equal(t, int64(1), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 96) + require.NoError(t, err) + require.Equal(t, int64(3), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 85) + require.NoError(t, err) + require.Equal(t, int64(3), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 84) + require.NoError(t, err) + require.Equal(t, int64(5), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 65) + require.NoError(t, err) + require.Equal(t, int64(5), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 64) + require.NoError(t, err) + require.Equal(t, int64(6), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 50) + require.NoError(t, err) + require.Equal(t, int64(6), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 40) + require.NoError(t, err) + require.Equal(t, int64(10), m) + + m, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 1) + require.NoError(t, err) + require.Equal(t, int64(10), m) + + _, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 0) + require.Error(t, err) + + _, err = providerKeeper.ComputeMinPowerToOptIn(ctx, bondedValidators, 101) + require.Error(t, err) +} + +// TestCanValidateChain returns true if `validator` is opted in, in `chainID. +func TestCanValidateChain(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + validator := createStakingValidator(ctx, mocks, 0, 1, 1) + consAddr, _ := validator.GetConsAddr() + providerAddr := types.NewProviderConsAddress(consAddr) + + // with no allowlist or denylist, the validator has to be opted in, in order to consider it + require.False(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + providerKeeper.SetOptedIn(ctx, "chainID", types.NewProviderConsAddress(consAddr)) + require.True(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + + // create an allow list but do not add the validator `providerAddr` to it + validatorA := createStakingValidator(ctx, mocks, 1, 1, 2) + consAddrA, _ := validatorA.GetConsAddr() + providerKeeper.SetAllowlist(ctx, "chainID", types.NewProviderConsAddress(consAddrA)) + require.False(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + providerKeeper.SetAllowlist(ctx, "chainID", types.NewProviderConsAddress(consAddr)) + require.True(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + + // create a denylist but do not add validator `providerAddr` to it + providerKeeper.SetDenylist(ctx, "chainID", types.NewProviderConsAddress(consAddrA)) + require.True(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) + // add validator `providerAddr` to the denylist + providerKeeper.SetDenylist(ctx, "chainID", types.NewProviderConsAddress(consAddr)) + require.False(t, providerKeeper.CanValidateChain(ctx, "chainID", providerAddr)) +} + +func TestCapValidatorSet(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + validatorA := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddrA"), + Power: 1, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + validatorB := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddrB"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + validatorC := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddrC"), + Power: 3, + ConsumerPublicKey: &crypto.PublicKey{}, + } + validators := []types.ConsumerValidator{validatorA, validatorB, validatorC} + + consumerValidators := providerKeeper.CapValidatorSet(ctx, "chainID", validators) + require.Equal(t, validators, consumerValidators) + + providerKeeper.SetValidatorSetCap(ctx, "chainID", 0) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + require.Equal(t, validators, consumerValidators) + + providerKeeper.SetValidatorSetCap(ctx, "chainID", 100) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + require.Equal(t, validators, consumerValidators) + + providerKeeper.SetValidatorSetCap(ctx, "chainID", 1) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + require.Equal(t, []types.ConsumerValidator{validatorC}, consumerValidators) + + providerKeeper.SetValidatorSetCap(ctx, "chainID", 2) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + require.Equal(t, []types.ConsumerValidator{validatorC, validatorB}, consumerValidators) + + providerKeeper.SetValidatorSetCap(ctx, "chainID", 3) + consumerValidators = providerKeeper.CapValidatorSet(ctx, "chainID", validators) + require.Equal(t, []types.ConsumerValidator{validatorC, validatorB, validatorA}, consumerValidators) +} + +func TestCapValidatorsPower(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + validatorA := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddrA"), + Power: 1, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + validatorB := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddrB"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + validatorC := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddrC"), + Power: 3, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + validatorD := types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddrD"), + Power: 4, + ConsumerPublicKey: &crypto.PublicKey{}, + } + + validators := []types.ConsumerValidator{validatorA, validatorB, validatorC, validatorD} + + expectedValidators := make([]types.ConsumerValidator, len(validators)) + copy(expectedValidators, validators) + expectedValidators[0].Power = 2 + expectedValidators[1].Power = 2 + expectedValidators[2].Power = 3 + expectedValidators[3].Power = 3 + + sortValidators := func(validators []types.ConsumerValidator) { + sort.Slice(validators, func(i, j int) bool { + return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 + }) + } + + // no capping takes place because validators power-cap is not set + cappedValidators := providerKeeper.CapValidatorsPower(ctx, "chainID", validators) + sortValidators(validators) + sortValidators(cappedValidators) + require.Equal(t, validators, cappedValidators) + + providerKeeper.SetValidatorsPowerCap(ctx, "chainID", 33) + cappedValidators = providerKeeper.CapValidatorsPower(ctx, "chainID", validators) + sortValidators(expectedValidators) + sortValidators(cappedValidators) + require.Equal(t, expectedValidators, cappedValidators) +} + +func TestNoMoreThanPercentOfTheSum(t *testing.T) { + // **impossible** case where we only have 9 powers, and we want that no number has more than 10% of the total sum + powers := []int64{1, 2, 3, 4, 5, 6, 7, 8, 9} + percent := uint32(10) + require.False(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) + + powers = []int64{1, 2, 3, 4, 5} + percent = 20 + require.True(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) + + powers = []int64{1, 2, 3, 4, 5} + percent = 21 + require.True(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) + + powers = []int64{1, 2, 3, 4, 5} + percent = 25 + require.True(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) + + powers = []int64{1, 2, 3, 4, 5} + percent = 32 + require.True(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) + + powers = []int64{1, 2, 3, 4, 5} + percent = 33 + require.True(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) + + powers = []int64{1, 2, 3, 4, 5} + percent = 34 + require.True(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) + + powers = []int64{1, 2, 3, 4, 5} + percent = 50 + require.True(t, noMoreThanPercent(keeper.NoMoreThanPercentOfTheSum(createConsumerValidators(powers), percent), percent)) +} + +func createConsumerValidators(powers []int64) []types.ConsumerValidator { + var validators []types.ConsumerValidator + for _, p := range powers { + validators = append(validators, types.ConsumerValidator{ + ProviderConsAddr: []byte("providerConsAddr"), + Power: p, + ConsumerPublicKey: &crypto.PublicKey{}, + }) + } + return validators +} + +// returns `true` if no validator in `validators` corresponds to more than `percent` of the total sum of all +// validators' powers +func noMoreThanPercent(validators []types.ConsumerValidator, percent uint32) bool { + sum := int64(0) + for _, v := range validators { + sum = sum + v.Power + } + + for _, v := range validators { + if float64(v.Power)*100.0 > float64(percent)*float64(sum) { + return false + } + } + return true +} + +func sumPowers(vals []types.ConsumerValidator) int64 { + sum := int64(0) + for _, v := range vals { + sum += v.Power + } + return sum +} + +func CapSatisfiable(vals []types.ConsumerValidator, percent uint32) bool { + // 100 / len(vals) is what each validator gets if each has the same power. + // if this is more than the cap, it cannot be satisfied. + return float64(100)/float64(len(vals)) < float64(percent) +} + +func TestNoMoreThanPercentOfTheSumProps(t *testing.T) { + // define properties to test + + // capRespectedIfSatisfiable: if the cap can be respected, then it will be respected + capRespectedIfSatisfiable := func(valsBefore, valsAfter []types.ConsumerValidator, percent uint32) bool { + if CapSatisfiable(valsBefore, percent) { + return noMoreThanPercent(valsAfter, percent) + } + return true + } + + evenPowersIfCapCannotBeSatisfied := func(valsBefore, valsAfter []types.ConsumerValidator, percent uint32) bool { + if !CapSatisfiable(valsBefore, percent) { + // if the cap cannot be satisfied, each validator should have the same power + for _, valAfter := range valsAfter { + if valAfter.Power != valsAfter[0].Power { + return false + } + } + } + return true + } + + // fairness: if before, v1 has more power than v2, then afterwards v1 will not have less power than v2 + // (they might get the same power if they are both capped) + fairness := func(valsBefore, valsAfter []types.ConsumerValidator) bool { + for i, v := range valsBefore { + // find the validator after with the same address + vAfter := findConsumerValidator(t, v, valsAfter) + + // go through all other validators before (after this one, to avoid double checking) + for j := i + 1; j < len(valsBefore); j++ { + otherV := valsBefore[j] + otherVAfter := findConsumerValidator(t, otherV, valsAfter) + + // v has at least as much power before + if v.Power >= otherV.Power { + // then otherV should not have more power after + if vAfter.Power < otherVAfter.Power { + return false + } + } else { + // v has less power before + // then v should not have more power after + if vAfter.Power > otherVAfter.Power { + return false + } + } + } + } + return true + } + + // non-zero: v has non-zero power before IFF it has non-zero power after + nonZero := func(valsBefore, valsAfter []types.ConsumerValidator) bool { + for _, v := range valsBefore { + vAfter := findConsumerValidator(t, v, valsAfter) + if (v.Power == 0) != (vAfter.Power == 0) { + return false + } + } + return true + } + + // equalSumIfCapSatisfiable: the sum of the powers of the validators will not change if the cap can be satisfied + // (except for small changes by rounding errors) + equalSumIfCapSatisfiable := func(valsBefore, valsAfter []types.ConsumerValidator, percent uint32) bool { + if CapSatisfiable(valsBefore, percent) { + difference := gomath.Abs(float64(sumPowers(valsBefore) - sumPowers(valsAfter))) + if difference > 1 { + // if the difference is more than a rounding error, they are not equal + return false + } + } + return true + } + + // num validators: the number of validators will not change + equalNumVals := func(valsBefore, valsAfter []types.ConsumerValidator) bool { + return len(valsBefore) == len(valsAfter) + } + + // test setup for pbt + rapid.Check(t, func(t *rapid.T) { + powers := rapid.SliceOf(rapid.Int64Range(1, 1000000000000)).Draw(t, "powers") + percent := uint32(rapid.Int32Range(1, 100).Draw(t, "percent")) + + consumerValidators := createConsumerValidators(powers) + cappedValidators := keeper.NoMoreThanPercentOfTheSum(consumerValidators, percent) + + t.Log("can the cap be satisfied: ", CapSatisfiable(consumerValidators, percent)) + t.Log("before: ", consumerValidators) + t.Log("after: ", cappedValidators) + + // check properties + require.True(t, capRespectedIfSatisfiable(consumerValidators, cappedValidators, percent)) + require.True(t, evenPowersIfCapCannotBeSatisfied(consumerValidators, cappedValidators, percent)) + require.True(t, fairness(consumerValidators, cappedValidators)) + require.True(t, nonZero(consumerValidators, cappedValidators)) + require.True(t, equalSumIfCapSatisfiable(consumerValidators, cappedValidators, percent), "sum before: %v, sum after: %v", sumPowers(consumerValidators), sumPowers(cappedValidators)) + require.True(t, equalNumVals(consumerValidators, cappedValidators), "num before: %v, num after: %v", len(consumerValidators), len(cappedValidators)) + }) +} + +func findConsumerValidator(t *testing.T, v types.ConsumerValidator, valsAfter []types.ConsumerValidator) *types.ConsumerValidator { + var vAfter *types.ConsumerValidator + for _, vA := range valsAfter { + if bytes.Equal(v.ProviderConsAddr, vA.ProviderConsAddr) { + vAfter = &vA + break + } + } + if vAfter == nil { + t.Fatalf("could not find validator with address %v in validators after \n validators after capping: %v", v.ProviderConsAddr, valsAfter) + } + return vAfter +} diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index ecb9b5156b..6a3f4339ad 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -1,11 +1,12 @@ package keeper import ( - "errors" "fmt" "strconv" "time" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" @@ -16,7 +17,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" tmtypes "github.com/cometbft/cometbft/types" @@ -41,8 +41,8 @@ func (k Keeper) HandleConsumerAdditionProposal(ctx sdk.Context, proposal *types. HistoricalEntries: proposal.HistoricalEntries, DistributionTransmissionChannel: proposal.DistributionTransmissionChannel, } - return k.HandleLegacyConsumerAdditionProposal(ctx, &p) + return k.HandleLegacyConsumerAdditionProposal(ctx, &p) } // Wrapper for the new proposal message MsgConsumerRemoval @@ -52,8 +52,8 @@ func (k Keeper) HandleConsumerRemovalProposal(ctx sdk.Context, proposal *types.M ChainId: proposal.ChainId, StopTime: proposal.StopTime, } - return k.HandleLegacyConsumerRemovalProposal(ctx, &p) + return k.HandleLegacyConsumerRemovalProposal(ctx, &p) } // Wrapper for the new proposal message MsgChangeRewardDenoms @@ -63,9 +63,26 @@ func (k Keeper) HandleConsumerRewardDenomProposal(ctx sdk.Context, proposal *typ DenomsToAdd: proposal.DenomsToAdd, DenomsToRemove: proposal.DenomsToRemove, } + return k.HandleLegacyConsumerRewardDenomProposal(ctx, &p) } +// HandleConsumerModificationProposal modifies a running consumer chain +func (k Keeper) HandleConsumerModificationProposal(ctx sdk.Context, proposal *types.MsgConsumerModification) error { + p := types.ConsumerModificationProposal{ + Title: proposal.Title, + Description: proposal.Description, + ChainId: proposal.ChainId, + Top_N: proposal.Top_N, + ValidatorsPowerCap: proposal.ValidatorsPowerCap, + ValidatorSetCap: proposal.ValidatorSetCap, + Allowlist: proposal.Allowlist, + Denylist: proposal.Denylist, + } + + return k.HandleLegacyConsumerModificationProposal(ctx, &p) +} + // CreateConsumerClient will create the CCV client for the given consumer chain. The CCV channel must be built // on top of the CCV client to ensure connection with the right consumer chain. // @@ -185,6 +202,12 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo k.DeleteVscSendTimestampsForConsumer(ctx, chainID) } + // delete consumer commission rate + provAddrs := k.GetAllCommissionRateValidators(ctx, chainID) + for _, addr := range provAddrs { + k.DeleteConsumerCommissionRate(ctx, chainID, addr) + } + k.DeleteInitChainHeight(ctx, chainID) k.DeleteSlashAcks(ctx, chainID) k.DeletePendingVSCPackets(ctx, chainID) @@ -209,6 +232,15 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo k.DeleteUnbondingOpIndex(ctx, chainID, unbondingOpsIndex.VscId) } + k.DeleteTopN(ctx, chainID) + k.DeleteValidatorsPowerCap(ctx, chainID) + k.DeleteValidatorSetCap(ctx, chainID) + k.DeleteAllowlist(ctx, chainID) + k.DeleteDenylist(ctx, chainID) + + k.DeleteAllOptedIn(ctx, chainID) + k.DeleteConsumerValSet(ctx, chainID) + k.Logger(ctx).Info("consumer chain removed from provider", "chainID", chainID) return nil @@ -244,43 +276,24 @@ func (k Keeper) MakeConsumerGenesis( return gen, nil, errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "error %s getting self consensus state for: %s", err, height) } - var lastPowers []stakingtypes.LastValidatorPower - - k.stakingKeeper.IterateLastValidatorPowers(ctx, func(addr sdk.ValAddress, power int64) (stop bool) { - lastPowers = append(lastPowers, stakingtypes.LastValidatorPower{Address: addr.String(), Power: power}) - return false - }) - - var bondedValidators []stakingtypes.Validator + // get the bonded validators from the staking module + bondedValidators, err := k.stakingKeeper.GetLastValidators(ctx) + if err != nil { + return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting last bonded validators: %s", err) + } - for _, p := range lastPowers { - addr, err := sdk.ValAddressFromBech32(p.Address) - if err != nil { + if topN, found := k.GetTopN(ctx, chainID); found && topN > 0 { + // in a Top-N chain, we automatically opt in all validators that belong to the top N + minPower, err := k.ComputeMinPowerToOptIn(ctx, bondedValidators, prop.Top_N) + if err == nil { + k.OptInTopNValidators(ctx, chainID, bondedValidators, minPower) + } else { return gen, nil, err } - - val, err := k.stakingKeeper.GetValidator(ctx, addr) - if err != nil && errors.Is(err, stakingtypes.ErrNoValidatorFound) { - return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting validator from LastValidatorPowers") - } else if err != nil { - return gen, nil, errorsmod.Wrapf(err, "error getting validator from LastValidatorPowers") - } - - // TODO: Remove this code block after main merge - // tmProtoPk, err := val.CmtConsPublicKey() - // if err != nil { - // return gen, nil, err - // } - - // initialUpdates = append(initialUpdates, abci.ValidatorUpdate{ - // PubKey: tmProtoPk, - // Power: p.Power, - // }) - // gather all the bonded validators in order to construct the consumer validator set for consumer chain `chainID` - bondedValidators = append(bondedValidators, val) } - nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chainID, bondedValidators) + nextValidators := k.ComputeNextValidators(ctx, chainID, bondedValidators) + k.SetConsumerValSet(ctx, chainID, nextValidators) // get the initial updates with the latest set consumer public keys @@ -364,14 +377,52 @@ func (k Keeper) GetPendingConsumerAdditionProp(ctx sdk.Context, spawnTime time.T func (k Keeper) BeginBlockInit(ctx sdk.Context) { propsToExecute := k.GetConsumerAdditionPropsToExecute(ctx) - for _, prop := range propsToExecute { + for i, prop := range propsToExecute { // create consumer client in a cached context to handle errors - cachedCtx, writeFn, err := k.CreateConsumerClientInCachedCtx(ctx, prop) + cachedCtx, writeFn := ctx.CacheContext() + + k.SetTopN(cachedCtx, prop.ChainId, prop.Top_N) + k.SetValidatorSetCap(cachedCtx, prop.ChainId, prop.ValidatorSetCap) + k.SetValidatorsPowerCap(cachedCtx, prop.ChainId, prop.ValidatorsPowerCap) + + for _, address := range prop.Allowlist { + consAddr, err := sdk.ConsAddressFromBech32(address) + if err != nil { + continue + } + + k.SetAllowlist(cachedCtx, prop.ChainId, types.NewProviderConsAddress(consAddr)) + } + + for _, address := range prop.Denylist { + consAddr, err := sdk.ConsAddressFromBech32(address) + if err != nil { + continue + } + + k.SetDenylist(cachedCtx, prop.ChainId, types.NewProviderConsAddress(consAddr)) + } + + err := k.CreateConsumerClient(cachedCtx, &propsToExecute[i]) if err != nil { // drop the proposal ctx.Logger().Info("consumer client could not be created: %w", err) continue } + + consumerGenesis, found := k.GetConsumerGenesis(cachedCtx, prop.ChainId) + if !found { + // drop the proposal + ctx.Logger().Info("consumer genesis could not be created") + continue + } + + if len(consumerGenesis.Provider.InitialValSet) == 0 { + // drop the proposal + ctx.Logger().Info("consumer genesis initial validator set is empty - no validators opted in") + continue + } + // The cached context is created with a new EventManager so we merge the event // into the original context ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 6968110de5..df6ad202d5 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -7,6 +7,8 @@ import ( "testing" "time" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" @@ -18,6 +20,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" + cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" @@ -28,6 +31,120 @@ import ( // Initialization sub-protocol related tests of proposal.go // +// Tests the HandleConsumerAdditionProposal method against the SpawnConsumerChainProposalHandler spec. +// See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-hcaprop1 +// Spec tag: [CCV-PCF-HCAPROP.1] +func TestHandleConsumerAdditionProposal(t *testing.T) { + type testCase struct { + description string + malleate func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) + prop *providertypes.ConsumerAdditionProposal + // Time when prop is handled + blockTime time.Time + // Whether it's expected that the proposal is successfully verified + // and appended to the pending proposals + expAppendProp bool + } + + // Snapshot times asserted in tests + now := time.Now().UTC() + + tests := []testCase{ + { + description: "expect to append valid proposal", + malleate: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) {}, + prop: providertypes.NewConsumerAdditionProposal( + "title", + "description", + "chainID", + clienttypes.NewHeight(2, 3), + []byte("gen_hash"), + []byte("bin_hash"), + now, // Spawn time + "0.75", + 10, + "", + 10000, + 100000000000, + 100000000000, + 100000000000, + 0, + 0, + 0, + nil, + nil, + ).(*providertypes.ConsumerAdditionProposal), + blockTime: now, + expAppendProp: true, + }, + { + description: "expect to not append invalid proposal using an already existing chain id", + malleate: func(ctx sdk.Context, k providerkeeper.Keeper, chainID string) { + k.SetConsumerClientId(ctx, chainID, "anyClientId") + }, + + prop: providertypes.NewConsumerAdditionProposal( + "title", + "description", + "chainID", + clienttypes.NewHeight(2, 3), + []byte("gen_hash"), + []byte("bin_hash"), + now, + "0.75", + 10, + "", + 10000, + 100000000000, + 100000000000, + 100000000000, + 0, + 0, + 0, + nil, + nil, + ).(*providertypes.ConsumerAdditionProposal), + blockTime: now, + expAppendProp: false, + }, + } + + for _, tc := range tests { + // Common setup + keeperParams := testkeeper.NewInMemKeeperParams(t) + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + providerKeeper.SetParams(ctx, providertypes.DefaultParams()) + ctx = ctx.WithBlockTime(tc.blockTime) + + if tc.expAppendProp { + // Mock calls are only asserted if we expect a client to be created. + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(1) + gomock.InOrder( + testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, tc.prop.ChainId, clienttypes.NewHeight(2, 3))..., + ) + } + + tc.malleate(ctx, providerKeeper, tc.prop.ChainId) + + err := providerKeeper.HandleLegacyConsumerAdditionProposal(ctx, tc.prop) + + if tc.expAppendProp { + require.NoError(t, err) + // check that prop was added to the stored pending props + gotProposal, found := providerKeeper.GetPendingConsumerAdditionProp(ctx, tc.prop.SpawnTime, tc.prop.ChainId) + require.True(t, found) + require.Equal(t, *tc.prop, gotProposal) + } else { + require.Error(t, err) + // check that prop wasn't added to the stored pending props + _, found := providerKeeper.GetPendingConsumerAdditionProp(ctx, tc.prop.SpawnTime, tc.prop.ChainId) + require.False(t, found) + } + + ctrl.Finish() + } +} + // Tests the CreateConsumerClient method against the spec, // with more granularity than what's covered in TestHandleCreateConsumerChainProposal. // See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-crclient1 @@ -45,6 +162,7 @@ func TestCreateConsumerClient(t *testing.T) { description: "No state mutation, new client should be created", setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) { // Valid client creation is asserted with mock expectations here + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(1) gomock.InOrder( testkeeper.GetMocksForCreateConsumerClient(ctx, mocks, "chainID", clienttypes.NewHeight(4, 5))..., ) @@ -60,7 +178,7 @@ func TestCreateConsumerClient(t *testing.T) { mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Times(0) mocks.MockClientKeeper.EXPECT().CreateClient(gomock.Any(), gomock.Any(), gomock.Any()).Times(0) mocks.MockClientKeeper.EXPECT().GetSelfConsensusState(gomock.Any(), gomock.Any()).Times(0) - mocks.MockStakingKeeper.EXPECT().IterateLastValidatorPowers(gomock.Any(), gomock.Any()).Times(0) + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(0) }, expClientCreated: false, }, @@ -264,10 +382,6 @@ func TestGetAllConsumerAdditionProps(t *testing.T) { require.Equal(t, expectedGetAllOrder, result) } -// -// Consumer Chain Removal sub-protocol related tests of proposal.go -// - // Tests the StopConsumerChain method against the spec, // with more granularity than what's covered in TestHandleLegacyConsumerRemovalProposal, or integration tests. // See: https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#ccv-pcf-stcc1 @@ -550,6 +664,7 @@ func TestMakeConsumerGenesis(t *testing.T) { // ctx = ctx.WithChainID("testchain1") // chainID is obtained from ctx ctx = ctx.WithBlockHeight(5) // RevisionHeight obtained from ctx + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(1) gomock.InOrder(testkeeper.GetMocksForMakeConsumerGenesis(ctx, &mocks, 1814400000000000)...) // matches params from jsonString @@ -689,6 +804,11 @@ func TestBeginBlockInit(t *testing.T) { 100000000000, 100000000000, 100000000000, + 50, + 0, + 0, + nil, + nil, ).(*providertypes.ConsumerAdditionProposal), providertypes.NewConsumerAdditionProposal( "title", "spawn time passed", "chain2", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, @@ -700,6 +820,11 @@ func TestBeginBlockInit(t *testing.T) { 100000000000, 100000000000, 100000000000, + 50, + 0, + 0, + nil, + nil, ).(*providertypes.ConsumerAdditionProposal), providertypes.NewConsumerAdditionProposal( "title", "spawn time not passed", "chain3", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, @@ -711,6 +836,11 @@ func TestBeginBlockInit(t *testing.T) { 100000000000, 100000000000, 100000000000, + 50, + 0, + 0, + nil, + nil, ).(*providertypes.ConsumerAdditionProposal), providertypes.NewConsumerAdditionProposal( "title", "invalid proposal: chain id already exists", "chain2", clienttypes.NewHeight(4, 5), []byte{}, []byte{}, @@ -722,38 +852,138 @@ func TestBeginBlockInit(t *testing.T) { 100000000000, 100000000000, 100000000000, + 50, + 0, + 0, + nil, + nil, + ).(*providertypes.ConsumerAdditionProposal), + providertypes.NewConsumerAdditionProposal( + "title", "opt-in chain with at least one validator opted in", "chain5", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, + now.Add(-time.Hour*1).UTC(), + "0.75", + 10, + "", + 10000, + 100000000000, + 100000000000, + 100000000000, + 0, + 0, + 0, + nil, + nil, + ).(*providertypes.ConsumerAdditionProposal), + providertypes.NewConsumerAdditionProposal( + "title", "opt-in chain with no validator opted in", "chain6", clienttypes.NewHeight(3, 4), []byte{}, []byte{}, + now.Add(-time.Minute).UTC(), + "0.75", + 10, + "", + 10000, + 100000000000, + 100000000000, + 100000000000, + 0, + 0, + 0, + nil, + nil, ).(*providertypes.ConsumerAdditionProposal), } - // Expect client creation for only for the 1st and second proposals (spawn time already passed and valid) - gomock.InOrder( - append(testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain1", clienttypes.NewHeight(3, 4)), - testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain2", clienttypes.NewHeight(3, 4))...)..., - ) + // Expect client creation for only the first, second, and fifth proposals (spawn time already passed and valid) + expectedCalls := testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain1", clienttypes.NewHeight(3, 4)) + expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain2", clienttypes.NewHeight(3, 4))...) + expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain5", clienttypes.NewHeight(3, 4))...) + + // The sixth proposal would have spawn time passed and hence needs the mocks but the client will not be + // created because `chain6` is an Opt In chain and has no validator opted in + expectedCalls = append(expectedCalls, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain6", clienttypes.NewHeight(3, 4))...) + + gomock.InOrder(expectedCalls...) for _, prop := range pendingProps { providerKeeper.SetPendingConsumerAdditionProp(ctx, prop) } + // opt in a sample validator so the chain's proposal can successfully execute + validator := cryptotestutil.NewCryptoIdentityFromIntSeed(0).SDKStakingValidator() + consAddr, _ := validator.GetConsAddr() + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Return([]stakingtypes.Validator{validator}, nil).AnyTimes() + valAdrr, _ := sdk.ValAddressFromBech32(validator.GetOperator()) + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAdrr).Return(int64(1), nil).AnyTimes() + providerKeeper.SetOptedIn(ctx, pendingProps[4].ChainId, providertypes.NewProviderConsAddress(consAddr)) + providerKeeper.BeginBlockInit(ctx) - // Only the third proposal is still stored as pending + // first proposal is not pending anymore because its spawn time already passed and was executed _, found := providerKeeper.GetPendingConsumerAdditionProp( ctx, pendingProps[0].SpawnTime, pendingProps[0].ChainId) require.False(t, found) + // first proposal was successfully executed and hence consumer genesis was created + _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[0].ChainId) + require.True(t, found) + // second proposal is not pending anymore because its spawn time already passed and was executed _, found = providerKeeper.GetPendingConsumerAdditionProp( ctx, pendingProps[1].SpawnTime, pendingProps[1].ChainId) require.False(t, found) + // second proposal was successfully executed and hence consumer genesis was created + _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[1].ChainId) + require.True(t, found) + // third proposal is still stored as pending because its spawn time has not passed _, found = providerKeeper.GetPendingConsumerAdditionProp( ctx, pendingProps[2].SpawnTime, pendingProps[2].ChainId) require.True(t, found) + // because the proposal is still pending, no consumer genesis was created + _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[2].ChainId) + require.False(t, found) - // check that the invalid proposal was dropped + // check that the invalid proposals were dropped _, found = providerKeeper.GetPendingConsumerAdditionProp( ctx, pendingProps[3].SpawnTime, pendingProps[3].ChainId) require.False(t, found) + // Note that we do not check that `GetConsumerGenesis(ctx, pendingProps[3].ChainId)` returns `false` here because + // `pendingProps[3]` is an invalid proposal due to the chain id already existing so the consumer genesis also exists + + // fifth proposal corresponds to an Opt-In chain with one opted-in validator and hence the proposal gets + // successfully executed + _, found = providerKeeper.GetPendingConsumerAdditionProp( + ctx, pendingProps[4].SpawnTime, pendingProps[4].ChainId) + require.False(t, found) + // fifth proposal was successfully executed and hence consumer genesis was created + _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[4].ChainId) + require.True(t, found) + + // sixth proposal corresponds to an Opt-In chain with no opted-in validators and hence the + // proposal is not successful + _, found = providerKeeper.GetPendingConsumerAdditionProp( + ctx, pendingProps[5].SpawnTime, pendingProps[5].ChainId) + // the proposal was dropped and deleted + require.False(t, found) + // no consumer genesis is created + _, found = providerKeeper.GetConsumerGenesis(ctx, pendingProps[5].ChainId) + require.False(t, found) + // no consumer client is associated with this chain + _, found = providerKeeper.GetConsumerClientId(ctx, pendingProps[5].ChainId) + require.False(t, found) + // no fields should be set for this (check some of them) + _, found = providerKeeper.GetTopN(ctx, pendingProps[5].ChainId) + require.False(t, found) + _, found = providerKeeper.GetValidatorsPowerCap(ctx, pendingProps[5].ChainId) + require.False(t, found) + _, found = providerKeeper.GetValidatorSetCap(ctx, pendingProps[5].ChainId) + require.False(t, found) + + // test that Top N is set correctly + require.True(t, providerKeeper.IsTopN(ctx, "chain1")) + topN, found := providerKeeper.GetTopN(ctx, "chain1") + require.True(t, found) + require.Equal(t, uint32(50), topN) + + require.True(t, providerKeeper.IsOptIn(ctx, "chain4")) } // TestBeginBlockCCR tests BeginBlockCCR against the spec. @@ -787,6 +1017,7 @@ func TestBeginBlockCCR(t *testing.T) { expectations := []*gomock.Call{} for _, prop := range pendingProps { // A consumer chain is setup corresponding to each prop, making these mocks necessary + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(1) expectations = append(expectations, testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, prop.ChainId, clienttypes.NewHeight(2, 3))...) expectations = append(expectations, testkeeper.GetMocksForSetConsumerChain(ctx, &mocks, prop.ChainId)...) @@ -805,6 +1036,7 @@ func TestBeginBlockCCR(t *testing.T) { additionProp := testkeeper.GetTestConsumerAdditionProp() additionProp.ChainId = prop.ChainId additionProp.InitialHeight = clienttypes.NewHeight(2, 3) + err := providerKeeper.CreateConsumerClient(ctx, additionProp) require.NoError(t, err) err = providerKeeper.SetConsumerChain(ctx, "channelID") @@ -823,6 +1055,7 @@ func TestBeginBlockCCR(t *testing.T) { // // Test execution // + providerKeeper.BeginBlockCCR(ctx) // Only the 3rd (final) proposal is still stored as pending diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 7dcf568a5f..8426c26037 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -227,7 +227,20 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { for _, chain := range k.GetAllConsumerChains(ctx) { currentValidators := k.GetConsumerValSet(ctx, chain.ChainId) - nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chain.ChainId, bondedValidators) + + if chain.Top_N > 0 { + // in a Top-N chain, we automatically opt in all validators that belong to the top N + minPower, err := k.ComputeMinPowerToOptIn(ctx, bondedValidators, chain.Top_N) + if err == nil { + k.OptInTopNValidators(ctx, chain.ChainId, bondedValidators, minPower) + } else { + // we just log here and do not panic because panic-ing would halt the provider chain + k.Logger(ctx).Error("failed to compute min power to opt in for chain", "chain", chain.ChainId, "error", err) + } + } + + nextValidators := k.ComputeNextValidators(ctx, chain.ChainId, bondedValidators) + valUpdates := DiffValidators(currentValidators, nextValidators) k.SetConsumerValSet(ctx, chain.ChainId, nextValidators) @@ -333,6 +346,16 @@ func (k Keeper) OnRecvSlashPacket( return ccv.V1Result, nil } + // Check that the validator belongs to the consumer chain valset + if !k.IsConsumerValidator(ctx, chainID, providerConsAddr) { + k.Logger(ctx).Error("cannot jail validator %s that does not belong to consumer %s valset", + providerConsAddr.String(), chainID) + // drop packet but return a slash ack so that the consumer can send another slash packet + k.AppendSlashAck(ctx, chainID, consumerConsAddr.String()) + + return ccv.SlashPacketHandledResult, nil + } + meter := k.GetSlashMeter(ctx) // Return bounce ack if meter is negative in value if meter.IsNegative() { diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 5b11e44d33..f28612d341 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -11,12 +11,15 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/interchain-security/v5/testutil/crypto" cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v5/testutil/keeper" "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" @@ -131,12 +134,22 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { // Set a block height for the valset update id in the generated packet data providerKeeper.SetValsetUpdateBlockHeight(ctx, packetData.ValsetUpdateId, uint64(15)) + // Set consumer validator + providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsumerValidator{ + ProviderConsAddr: packetData.Validator.Address, + }) + // Set slash meter to negative value and assert a bounce ack is returned providerKeeper.SetSlashMeter(ctx, math.NewInt(-5)) ackResult, err := executeOnRecvSlashPacket(t, &providerKeeper, ctx, "channel-1", 1, packetData) require.Equal(t, ccv.SlashPacketBouncedResult, ackResult) require.NoError(t, err) + // Set consumer validator + providerKeeper.SetConsumerValidator(ctx, "chain-2", providertypes.ConsumerValidator{ + ProviderConsAddr: packetData.Validator.Address, + }) + // Also bounced for chain-2 ackResult, err = executeOnRecvSlashPacket(t, &providerKeeper, ctx, "channel-2", 2, packetData) require.Equal(t, ccv.SlashPacketBouncedResult, ackResult) @@ -145,6 +158,9 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { // Now set slash meter to positive value and assert slash packet handled result is returned providerKeeper.SetSlashMeter(ctx, math.NewInt(5)) + // Set the consumer validator + providerKeeper.SetConsumerValidator(ctx, "chain-1", providertypes.ConsumerValidator{ProviderConsAddr: packetData.Validator.Address}) + // Mock call to GetEffectiveValPower, so that it returns 2. providerAddr := providertypes.NewProviderConsAddress(packetData.Validator.Address) calls := []*gomock.Call{ @@ -302,6 +318,7 @@ func TestValidateSlashPacket(t *testing.T) { func TestHandleSlashPacket(t *testing.T) { chainId := "consumer-id" validVscID := uint64(234) + providerConsAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(7842334).ProviderConsAddress() consumerConsAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(784987634).ConsumerConsAddress() @@ -309,8 +326,9 @@ func TestHandleSlashPacket(t *testing.T) { name string packetData ccv.SlashPacketData // The mocks that we expect to be called for the specified packet data. - expectedCalls func(sdk.Context, testkeeper.MockedKeepers, ccv.SlashPacketData) []*gomock.Call - expectedSlashAcksLen int + expectedCalls func(sdk.Context, testkeeper.MockedKeepers, ccv.SlashPacketData) []*gomock.Call + expectedSlashAcksLen int + expectedSlashAckConsumerConsAddress providertypes.ConsumerConsAddress }{ { "unfound validator", @@ -332,6 +350,7 @@ func TestHandleSlashPacket(t *testing.T) { } }, 0, + consumerConsAddr, }, { "found, but tombstoned validator", @@ -354,6 +373,7 @@ func TestHandleSlashPacket(t *testing.T) { } }, 0, + consumerConsAddr, }, { "drop packet when infraction height not found", @@ -377,6 +397,7 @@ func TestHandleSlashPacket(t *testing.T) { } }, 0, + consumerConsAddr, }, { "full downtime packet handling, uses init chain height and non-jailed validator", @@ -394,6 +415,7 @@ func TestHandleSlashPacket(t *testing.T) { true) // expectJailing = true }, 1, + consumerConsAddr, }, { "full downtime packet handling, uses valid vscID and jailed validator", @@ -411,39 +433,42 @@ func TestHandleSlashPacket(t *testing.T) { false) // expectJailing = false, validator is already jailed. }, 1, + consumerConsAddr, }, // Note: double-sign slash packet handling should not occur, see OnRecvSlashPacket. } for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx( + t, testkeeper.NewInMemKeeperParams(t)) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx( - t, testkeeper.NewInMemKeeperParams(t)) - - // Setup expected mock calls - gomock.InOrder(tc.expectedCalls(ctx, mocks, tc.packetData)...) + // Setup expected mock calls + gomock.InOrder(tc.expectedCalls(ctx, mocks, tc.packetData)...) - // Setup init chain height and a single valid valset update ID to block height mapping. - providerKeeper.SetInitChainHeight(ctx, chainId, 5) - providerKeeper.SetValsetUpdateBlockHeight(ctx, validVscID, 99) + // Setup init chain height and a single valid valset update ID to block height mapping. + providerKeeper.SetInitChainHeight(ctx, chainId, 5) + providerKeeper.SetValsetUpdateBlockHeight(ctx, validVscID, 99) - // Setup consumer address to provider address mapping. - require.NotEmpty(t, tc.packetData.Validator.Address) - providerKeeper.SetValidatorByConsumerAddr(ctx, chainId, consumerConsAddr, providerConsAddr) + // Setup consumer address to provider address mapping. + require.NotEmpty(t, tc.packetData.Validator.Address) + providerKeeper.SetValidatorByConsumerAddr(ctx, chainId, consumerConsAddr, providerConsAddr) + providerKeeper.SetConsumerValidator(ctx, chainId, providertypes.ConsumerValidator{ProviderConsAddr: providerConsAddr.Address.Bytes()}) - // Execute method and assert expected mock calls. - providerKeeper.HandleSlashPacket(ctx, chainId, tc.packetData) + // Execute method and assert expected mock calls. + providerKeeper.HandleSlashPacket(ctx, chainId, tc.packetData) - require.Equal(t, tc.expectedSlashAcksLen, len(providerKeeper.GetSlashAcks(ctx, chainId))) + require.Equal(t, tc.expectedSlashAcksLen, len(providerKeeper.GetSlashAcks(ctx, chainId))) - if tc.expectedSlashAcksLen == 1 { - // must match the consumer address - require.Equal(t, consumerConsAddr.String(), providerKeeper.GetSlashAcks(ctx, chainId)[0]) - require.NotEqual(t, providerConsAddr.String(), providerKeeper.GetSlashAcks(ctx, chainId)[0]) - require.NotEqual(t, providerConsAddr.String(), consumerConsAddr.String()) - } + if tc.expectedSlashAcksLen == 1 { + // must match the consumer address + require.Equal(t, tc.expectedSlashAckConsumerConsAddress.String(), providerKeeper.GetSlashAcks(ctx, chainId)[0]) + require.NotEqual(t, providerConsAddr.String(), providerKeeper.GetSlashAcks(ctx, chainId)[0]) + require.NotEqual(t, providerConsAddr.String(), consumerConsAddr.String()) + } - ctrl.Finish() + ctrl.Finish() + }) } } @@ -458,6 +483,10 @@ func TestHandleVSCMaturedPacket(t *testing.T) { // Start first unbonding without any consumers registered var unbondingOpId uint64 = 1 + gomock.InOrder( + mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_Undefined, stakingtypes.ErrNoUnbondingType), + ) + err := pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) require.NoError(t, err) // Check that no unbonding op was stored @@ -468,12 +497,34 @@ func TestHandleVSCMaturedPacket(t *testing.T) { pk.IncrementValidatorSetUpdateId(ctx) require.Equal(t, uint64(2), pk.GetValidatorSetUpdateId(ctx)) - // Registered first consumer + // Register first consumer pk.SetConsumerClientId(ctx, "chain-1", "client-1") + // Create 2 validators + vals := []stakingtypes.Validator{} + valsPk := []cryptotypes.PubKey{} + for i := 0; i < 2; i++ { + pubkey, err := cryptocodec.FromTmPubKeyInterface(cryptotestutil.NewCryptoIdentityFromIntSeed(54321 + i).TMCryptoPubKey()) + require.NoError(t, err) + valsPk = append(valsPk, pubkey) + pkAny, err := codectypes.NewAnyWithValue(pubkey) + require.NoError(t, err) + vals = append(vals, stakingtypes.Validator{ConsensusPubkey: pkAny}) + } + + // Opt-in one validator to consumer + pk.SetConsumerValidator(ctx, "chain-1", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[0].Address()}) + // Start second unbonding unbondingOpId = 2 gomock.InOrder( + mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_UnbondingDelegation, nil), + mocks.MockStakingKeeper.EXPECT().GetUnbondingDelegationByUnbondingID(ctx, unbondingOpId).Return( + stakingtypes.UnbondingDelegation{ + ValidatorAddress: sdk.ValAddress([]byte{1}).String(), + }, nil), + mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). + Return(vals[0], nil), mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, unbondingOpId).Return(nil), ) err = pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) @@ -497,10 +548,21 @@ func TestHandleVSCMaturedPacket(t *testing.T) { // Registered second consumer pk.SetConsumerClientId(ctx, "chain-2", "client-2") + // Opt-in both validators to second consumer + pk.SetConsumerValidator(ctx, "chain-2", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[0].Address()}) + pk.SetConsumerValidator(ctx, "chain-2", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[1].Address()}) + // Start third and fourth unbonding unbondingOpIds := []uint64{3, 4} for _, id := range unbondingOpIds { gomock.InOrder( + mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, id).Return(stakingtypes.UnbondingType_Redelegation, nil), + mocks.MockStakingKeeper.EXPECT().GetRedelegationByUnbondingID(ctx, id).Return( + stakingtypes.Redelegation{ + ValidatorSrcAddress: sdk.ValAddress([]byte{1}).String(), + }, nil), + mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). + Return(vals[0], nil), mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, id).Return(nil), ) err = pk.Hooks().AfterUnbondingInitiated(ctx, id) @@ -521,6 +583,33 @@ func TestHandleVSCMaturedPacket(t *testing.T) { require.Equal(t, unbondingOpIds, ids) } + // Increment vscID + pk.IncrementValidatorSetUpdateId(ctx) + require.Equal(t, uint64(4), pk.GetValidatorSetUpdateId(ctx)) + + // Start fith unbonding + unbondingOpId = 5 + gomock.InOrder( + mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_ValidatorUnbonding, nil), + mocks.MockStakingKeeper.EXPECT().GetValidatorByUnbondingID(ctx, unbondingOpId).Return( + stakingtypes.Validator{ + OperatorAddress: sdk.ValAddress([]byte{1}).String(), + }, nil), + mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). + Return(vals[1], nil), + mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, unbondingOpId).Return(nil), + ) + err = pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) + require.NoError(t, err) + + // Check that an unbonding op was stored for chain-2 only + // since it's the only consumer the unbonding validator has opted-in to + expectedChains = []string{"chain-2"} + unbondingOp, found = pk.GetUnbondingOp(ctx, unbondingOpId) + require.True(t, found) + require.Equal(t, unbondingOpId, unbondingOp.Id) + require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) + // Handle VSCMatured packet from chain-1 for vscID 1. // Note that no VSCPacket was sent as the chain was not yet registered, // but the code should still work @@ -672,6 +761,10 @@ func TestEndBlockVSU(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() + chainID := "chainID" + + providerKeeper.SetTopN(ctx, chainID, 100) + // 10 blocks constitute an epoch params := providertypes.DefaultParams() params.BlocksPerEpoch = 10 @@ -680,33 +773,115 @@ func TestEndBlockVSU(t *testing.T) { // create 4 sample lastValidators var lastValidators []stakingtypes.Validator for i := 0; i < 4; i++ { - lastValidators = append(lastValidators, cryptotestutil.NewCryptoIdentityFromIntSeed(i).SDKStakingValidator()) + validator := crypto.NewCryptoIdentityFromIntSeed(i).SDKStakingValidator() + lastValidators = append(lastValidators, validator) + valAdrr, err := sdk.ValAddressFromBech32(validator.GetOperator()) + require.NoError(t, err) + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), valAdrr).Return(int64(i+1), nil).AnyTimes() } + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Return(lastValidators, nil).AnyTimes() - mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), gomock.Any()).Return(int64(2), nil).AnyTimes() // set a sample client for a consumer chain so that `GetAllConsumerChains` in `QueueVSCPackets` iterates at least once - providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + providerKeeper.SetConsumerClientId(ctx, chainID, "clientID") // with block height of 1 we do not expect any queueing of VSC packets ctx = ctx.WithBlockHeight(1) providerKeeper.EndBlockVSU(ctx) - require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, "chainID"))) + require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) // with block height of 5 we do not expect any queueing of VSC packets ctx = ctx.WithBlockHeight(5) providerKeeper.EndBlockVSU(ctx) - require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, "chainID"))) + require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) // with block height of 10 we expect the queueing of one VSC packet ctx = ctx.WithBlockHeight(10) providerKeeper.EndBlockVSU(ctx) - require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, "chainID"))) + require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) // With block height of 15 we expect no additional queueing of a VSC packet. // Note that the pending VSC packet is still there because `SendVSCPackets` does not send the packet. We // need to mock channels, etc. for this to work, and it's out of scope for this test. ctx = ctx.WithBlockHeight(15) providerKeeper.EndBlockVSU(ctx) - require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, "chainID"))) + require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, chainID))) +} + +// TestQueueVSCPacketsWithPowerCapping tests queueing validator set updates with power capping +func TestQueueVSCPacketsWithPowerCapping(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + providerKeeper.SetValidatorSetUpdateId(ctx, 1) + + valA := createStakingValidator(ctx, mocks, 1, 1, 1) // 3.125% of the total voting power + valAConsAddr, _ := valA.GetConsAddr() + valAPubKey, _ := valA.TmConsPublicKey() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valAConsAddr).Return(valA, nil).AnyTimes() + valB := createStakingValidator(ctx, mocks, 2, 3, 2) // 9.375% of the total voting power + valBConsAddr, _ := valB.GetConsAddr() + valBPubKey, _ := valB.TmConsPublicKey() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valBConsAddr).Return(valB, nil).AnyTimes() + valC := createStakingValidator(ctx, mocks, 3, 4, 3) // 12.5% of the total voting power + valCConsAddr, _ := valC.GetConsAddr() + valCPubKey, _ := valC.TmConsPublicKey() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valCConsAddr).Return(valC, nil).AnyTimes() + valD := createStakingValidator(ctx, mocks, 4, 8, 4) // 25% of the total voting power + valDConsAddr, _ := valD.GetConsAddr() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valDConsAddr).Return(valD, nil).AnyTimes() + valE := createStakingValidator(ctx, mocks, 5, 16, 5) // 50% of the total voting power + valEConsAddr, _ := valE.GetConsAddr() + valEPubKey, _ := valE.TmConsPublicKey() + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valEConsAddr).Return(valE, nil).AnyTimes() + + mocks.MockStakingKeeper.EXPECT().GetLastValidators(ctx).Return([]stakingtypes.Validator{valA, valB, valC, valD, valE}, nil).AnyTimes() + + // add a consumer chain + providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + + providerKeeper.SetTopN(ctx, "chainID", 50) // would opt in E + + // opt in all validators + providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valAConsAddr)) + providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valBConsAddr)) + providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valCConsAddr)) + providerKeeper.SetOptedIn(ctx, "chainID", providertypes.NewProviderConsAddress(valDConsAddr)) + + // denylist validator D + providerKeeper.SetDenylist(ctx, "chainID", providertypes.NewProviderConsAddress(valDConsAddr)) + + // set a power-capping of 40% + providerKeeper.SetValidatorsPowerCap(ctx, "chainID", 40) + + providerKeeper.QueueVSCPackets(ctx) + + actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, "chainID") + expectedQueuedVSCPackets := []ccv.ValidatorSetChangePacketData{ + ccv.NewValidatorSetChangePacketData( + []abci.ValidatorUpdate{ + // validator D is not here because it was denylisted + // powers have changed because of power capping + { + PubKey: valEPubKey, + Power: 9, + }, + { + PubKey: valCPubKey, + Power: 6, + }, + { + PubKey: valBPubKey, + Power: 5, + }, + { + PubKey: valAPubKey, + Power: 4, + }, + }, + 1, + nil), + } + + require.Equal(t, expectedQueuedVSCPackets, actualQueuedVSCPackets) } diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 8617d283cf..0e92b08bae 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -27,6 +27,15 @@ func (k Keeper) SetConsumerValidator( store.Set(types.ConsumerValidatorKey(chainID, validator.ProviderConsAddr), bz) } +// SetConsumerValSet resets the current consumer validators with the `nextValidators` computed by +// `FilterValidators` and hence this method should only be called after `FilterValidators` has completed. +func (k Keeper) SetConsumerValSet(ctx sdk.Context, chainID string, nextValidators []types.ConsumerValidator) { + k.DeleteConsumerValSet(ctx, chainID) + for _, val := range nextValidators { + k.SetConsumerValidator(ctx, chainID, val) + } +} + // DeleteConsumerValidator removes consumer validator with `providerAddr` address func (k Keeper) DeleteConsumerValidator( ctx sdk.Context, @@ -58,11 +67,7 @@ func (k Keeper) DeleteConsumerValSet( // IsConsumerValidator returns `true` if the consumer validator with `providerAddr` exists for chain `chainID` // and `false` otherwise -func (k Keeper) IsConsumerValidator( - ctx sdk.Context, - chainID string, - providerAddr types.ProviderConsAddress, -) bool { +func (k Keeper) IsConsumerValidator(ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress) bool { store := ctx.KVStore(k.storeKey) return store.Get(types.ConsumerValidatorKey(chainID, providerAddr.ToSdkConsAddr())) != nil } @@ -89,58 +94,6 @@ func (k Keeper) GetConsumerValSet( return validators } -// ComputeNextEpochConsumerValSet returns the next validator set that is responsible for validating consumer -// chain `chainID`, based on the bonded validators. -func (k Keeper) ComputeNextEpochConsumerValSet( - ctx sdk.Context, - chainID string, - bondedValidators []stakingtypes.Validator, -) []types.ConsumerValidator { - var nextValidators []types.ConsumerValidator - for _, val := range bondedValidators { - valoper, err := k.ValidatorAddressCodec().StringToBytes(val.GetOperator()) - if err != nil { - panic(fmt.Errorf("could not decode validator operator: %w", err)) - } - // get next voting power and the next consumer public key - nextPower, err := k.stakingKeeper.GetLastValidatorPower(ctx, valoper) - if err != nil { - panic(fmt.Errorf("could not get last validator power: %w", err)) - } - consAddr, err := val.GetConsAddr() - if err != nil { - // this should never happen but is recoverable if we exclude this validator from the `nextValidators` - k.Logger(ctx).Error("could not get consensus address of validator", - "validator", val.GetOperator(), - "error", err) - continue - } - nextConsumerPublicKey, foundConsumerPublicKey := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) - if !foundConsumerPublicKey { - // if no consumer key assigned then use the validator's key itself - k.Logger(ctx).Info("could not retrieve public key for validator on consumer chain because"+ - " the validator did not assign a new consumer key", - "validator", val.GetOperator(), - "chainID", chainID) - nextConsumerPublicKey, err = val.CmtConsPublicKey() - if err != nil { - // this should never happen and might not be recoverable because without the public key - // we cannot generate a validator update - panic(fmt.Errorf("could not retrieve validator's (%+v) public key: %w", val, err)) - } - } - - nextValidator := types.ConsumerValidator{ - ProviderConsAddr: consAddr, - Power: nextPower, - ConsumerPublicKey: &nextConsumerPublicKey, - } - nextValidators = append(nextValidators, nextValidator) - } - - return nextValidators -} - // DiffValidators compares the current and the next epoch's consumer validators and returns the `ValidatorUpdate` diff // needed by CometBFT to update the validator set on a chain. func DiffValidators( @@ -149,12 +102,12 @@ func DiffValidators( ) []abci.ValidatorUpdate { var updates []abci.ValidatorUpdate - isCurrentValidator := make(map[string]types.ConsumerValidator) + isCurrentValidator := make(map[string]types.ConsumerValidator, len(currentValidators)) for _, val := range currentValidators { isCurrentValidator[val.ConsumerPublicKey.String()] = val } - isNextValidator := make(map[string]types.ConsumerValidator) + isNextValidator := make(map[string]types.ConsumerValidator, len(nextValidators)) for _, val := range nextValidators { isNextValidator[val.ConsumerPublicKey.String()] = val } @@ -182,11 +135,62 @@ func DiffValidators( return updates } -// SetConsumerValSet resets the current consumer validators with the `nextValidators` computed by -// `ComputeNextEpochConsumerValSet` and hence this method should only be called after `ComputeNextEpochConsumerValSet` has completed. -func (k Keeper) SetConsumerValSet(ctx sdk.Context, chainID string, nextValidators []types.ConsumerValidator) { - k.DeleteConsumerValSet(ctx, chainID) - for _, val := range nextValidators { - k.SetConsumerValidator(ctx, chainID, val) +// CreateConsumerValidator creates a consumer validator for `chainID` from the given staking `validator` +func (k Keeper) CreateConsumerValidator(ctx sdk.Context, chainID string, validator stakingtypes.Validator) (types.ConsumerValidator, error) { + valAddr, err := sdk.ValAddressFromBech32(validator.GetOperator()) + if err != nil { + return types.ConsumerValidator{}, err + } + power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) + consAddr, err := validator.GetConsAddr() + if err != nil { + return types.ConsumerValidator{}, fmt.Errorf("could not retrieve validator's (%+v) consensus address: %w", + validator, err) } + + consumerPublicKey, foundConsumerPublicKey := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) + if !foundConsumerPublicKey { + consumerPublicKey, err = validator.TmConsPublicKey() + if err != nil { + return types.ConsumerValidator{}, fmt.Errorf("could not retrieve validator's (%+v) public key: %w", validator, err) + } + } + + return types.ConsumerValidator{ + ProviderConsAddr: consAddr, + Power: power, + ConsumerPublicKey: &consumerPublicKey, + }, nil +} + +// FilterValidators filters the provided `bondedValidators` according to `predicate` and returns +// the filtered set. +func (k Keeper) FilterValidators( + ctx sdk.Context, + chainID string, + bondedValidators []stakingtypes.Validator, + predicate func(providerAddr types.ProviderConsAddress) bool, +) []types.ConsumerValidator { + var nextValidators []types.ConsumerValidator + for _, val := range bondedValidators { + consAddr, err := val.GetConsAddr() + if err != nil { + continue + } + + if predicate(types.NewProviderConsAddress(consAddr)) { + nextValidator, err := k.CreateConsumerValidator(ctx, chainID, val) + if err != nil { + // this should never happen but is recoverable if we exclude this validator from the next validator set + k.Logger(ctx).Error("could not create consumer validator", + "validator", val.GetOperator(), + "error", err) + continue + } + + nextValidators = append(nextValidators, nextValidator) + } + } + + return nextValidators } diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index 8808cf140d..43bc5a0370 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -13,7 +13,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cometbft/cometbft/proto/tendermint/crypto" cryptotestutil "github.com/cosmos/interchain-security/v5/testutil/crypto" @@ -110,62 +109,23 @@ func createConsumerValidator(index int, power int64, seed int) (types.ConsumerVa }, publicKey } -func TestComputeNextEpochConsumerValSet(t *testing.T) { - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - chainID := "chainID" +// createStakingValidator helper function to generate a validator with the given power and with a provider address based on index +func createStakingValidator(ctx sdk.Context, mocks testkeeper.MockedKeepers, index int, power int64, seed int) stakingtypes.Validator { + providerConsPubKey := cryptotestutil.NewCryptoIdentityFromIntSeed(seed).TMProtoCryptoPublicKey() - // helper function to generate a validator with the given power and with a provider address based on index - createStakingValidator := func(ctx sdk.Context, mocks testkeeper.MockedKeepers, index int, power int64) stakingtypes.Validator { - providerConsPubKey := ed25519.GenPrivKeyFromSecret([]byte{byte(index)}).PubKey() - consAddr := sdk.ConsAddress(providerConsPubKey.Address()) - providerAddr := types.NewProviderConsAddress(consAddr) - pk, _ := cryptocodec.FromCmtPubKeyInterface(providerConsPubKey) - pkAny, _ := codectypes.NewAnyWithValue(pk) + pk, _ := cryptocodec.FromCmtProtoPublicKey(providerConsPubKey) + pkAny, _ := codectypes.NewAnyWithValue(pk) + consAddr := sdk.ConsAddress(pk.Address()) + providerAddr := types.NewProviderConsAddress(consAddr) + providerValidatorAddr := sdk.ValAddress(providerAddr.Address.Bytes()) - var providerValidatorAddr sdk.ValAddress = providerAddr.Address.Bytes() + mocks.MockStakingKeeper.EXPECT(). + GetLastValidatorPower(ctx, providerValidatorAddr).Return(power, nil).AnyTimes() - mocks.MockStakingKeeper.EXPECT(). - GetLastValidatorPower(ctx, providerValidatorAddr).Return(power, nil).AnyTimes() - - return stakingtypes.Validator{ - OperatorAddress: providerValidatorAddr.String(), - ConsensusPubkey: pkAny, - } + return stakingtypes.Validator{ + OperatorAddress: providerValidatorAddr.String(), + ConsensusPubkey: pkAny, } - - // no consumer validators returned if we have no bonded validators - require.Empty(t, providerKeeper.ComputeNextEpochConsumerValSet(ctx, chainID, []stakingtypes.Validator{})) - - var expectedValidators []types.ConsumerValidator - - // create a staking validator A that has not set a consumer public key - valA := createStakingValidator(ctx, mocks, 1, 1) - // because validator A has no consumer key set, the `ConsumerPublicKey` we expect is the key on the provider chain - valAConsAddr, _ := valA.GetConsAddr() - valAPublicKey, _ := valA.CmtConsPublicKey() - expectedValidators = append(expectedValidators, types.ConsumerValidator{ - ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), - Power: 1, - ConsumerPublicKey: &valAPublicKey, - }) - - // create a staking validator B that has set a consumer public key - valB := createStakingValidator(ctx, mocks, 2, 2) - // validator B has set a consumer key, the `ConsumerPublicKey` we expect is the key set by `SetValidatorConsumerPubKey` - valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() - valBConsAddr, _ := valB.GetConsAddr() - providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) - expectedValidators = append(expectedValidators, types.ConsumerValidator{ - ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), - Power: 2, - ConsumerPublicKey: &valBConsumerKey, - }) - - bondedValidators := []stakingtypes.Validator{valA, valB} - actualValidators := providerKeeper.ComputeNextEpochConsumerValSet(ctx, "chainID", bondedValidators) - require.Equal(t, expectedValidators, actualValidators) } func TestDiff(t *testing.T) { @@ -366,3 +326,153 @@ func TestSetConsumerValSet(t *testing.T) { sortValidators(nextCurrentValidators) require.Equal(t, nextValidators, nextCurrentValidators) } + +func TestFilterValidatorsConsiderAll(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + // no consumer validators returned if we have no bonded validators + considerAll := func(providerAddr types.ProviderConsAddress) bool { return true } + require.Empty(t, providerKeeper.FilterValidators(ctx, chainID, []stakingtypes.Validator{}, considerAll)) + + var expectedValidators []types.ConsumerValidator + + // create a staking validator A that has not set a consumer public key + valA := createStakingValidator(ctx, mocks, 1, 1, 1) + // because validator A has no consumer key set, the `ConsumerPublicKey` we expect is the key on the provider chain + valAConsAddr, _ := valA.GetConsAddr() + valAPublicKey, _ := valA.TmConsPublicKey() + expectedValidators = append(expectedValidators, types.ConsumerValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), + Power: 1, + ConsumerPublicKey: &valAPublicKey, + }) + + // create a staking validator B that has set a consumer public key + valB := createStakingValidator(ctx, mocks, 2, 2, 2) + // validator B has set a consumer key, the `ConsumerPublicKey` we expect is the key set by `SetValidatorConsumerPubKey` + valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() + valBConsAddr, _ := valB.GetConsAddr() + providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) + expectedValidators = append(expectedValidators, types.ConsumerValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), + Power: 2, + ConsumerPublicKey: &valBConsumerKey, + }) + + bondedValidators := []stakingtypes.Validator{valA, valB} + actualValidators := providerKeeper.FilterValidators(ctx, chainID, bondedValidators, considerAll) + require.Equal(t, expectedValidators, actualValidators) +} + +func TestFilterValidatorsConsiderOnlyOptIn(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + // no consumer validators returned if we have no opted-in validators + require.Empty(t, providerKeeper.FilterValidators(ctx, chainID, []stakingtypes.Validator{}, + func(providerAddr types.ProviderConsAddress) bool { + return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) + })) + + var expectedValidators []types.ConsumerValidator + + // create a staking validator A that has not set a consumer public key + valA := createStakingValidator(ctx, mocks, 1, 1, 1) + // because validator A has no consumer key set, the `ConsumerPublicKey` we expect is the key on the provider chain + valAConsAddr, _ := valA.GetConsAddr() + valAPublicKey, _ := valA.TmConsPublicKey() + expectedValAConsumerValidator := types.ConsumerValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), + Power: 1, + ConsumerPublicKey: &valAPublicKey, + } + expectedValidators = append(expectedValidators, expectedValAConsumerValidator) + + // create a staking validator B that has set a consumer public key + valB := createStakingValidator(ctx, mocks, 2, 2, 2) + // validator B has set a consumer key, the `ConsumerPublicKey` we expect is the key set by `SetValidatorConsumerPubKey` + valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() + valBConsAddr, _ := valB.GetConsAddr() + providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) + expectedValBConsumerValidator := types.ConsumerValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), + Power: 2, + ConsumerPublicKey: &valBConsumerKey, + } + expectedValidators = append(expectedValidators, expectedValBConsumerValidator) + + // opt in validators A and B with 0 power and no consumer public keys + providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valAConsAddr)) + providerKeeper.SetOptedIn(ctx, chainID, types.NewProviderConsAddress(valBConsAddr)) + + // the expected actual validators are the opted-in validators but with the correct power and consumer public keys set + bondedValidators := []stakingtypes.Validator{valA, valB} + actualValidators := providerKeeper.FilterValidators(ctx, "chainID", bondedValidators, + func(providerAddr types.ProviderConsAddress) bool { + return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) + }) + + // sort validators first to be able to compare + sortValidators := func(validators []types.ConsumerValidator) { + sort.Slice(validators, func(i, j int) bool { + return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 + }) + } + + sortValidators(actualValidators) + sortValidators(expectedValidators) + require.Equal(t, expectedValidators, actualValidators) + + // create a staking validator C that is not opted in, hence `expectedValidators` remains the same + valC := createStakingValidator(ctx, mocks, 3, 3, 3) + bondedValidators = []stakingtypes.Validator{valA, valB, valC} + actualValidators = providerKeeper.FilterValidators(ctx, "chainID", bondedValidators, + func(providerAddr types.ProviderConsAddress) bool { + return providerKeeper.IsOptedIn(ctx, chainID, providerAddr) + }) + + sortValidators(actualValidators) + sortValidators(expectedValidators) + require.Equal(t, expectedValidators, actualValidators) +} + +func TestCreateConsumerValidator(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + // create a validator which has set a consumer public key + valA := createStakingValidator(ctx, mocks, 0, 1, 1) + valAConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() + valAConsAddr, _ := valA.GetConsAddr() + valAProviderConsAddr := types.NewProviderConsAddress(valAConsAddr) + providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, valAProviderConsAddr, valAConsumerKey) + actualConsumerValidatorA, err := providerKeeper.CreateConsumerValidator(ctx, chainID, valA) + expectedConsumerValidatorA := types.ConsumerValidator{ + ProviderConsAddr: valAProviderConsAddr.ToSdkConsAddr(), + Power: 1, + ConsumerPublicKey: &valAConsumerKey, + } + require.Equal(t, expectedConsumerValidatorA, actualConsumerValidatorA) + require.NoError(t, err) + + // create a validator which has not set a consumer public key + valB := createStakingValidator(ctx, mocks, 1, 2, 2) + valBConsAddr, _ := valB.GetConsAddr() + valBProviderConsAddr := types.NewProviderConsAddress(valBConsAddr) + valBPublicKey, _ := valB.TmConsPublicKey() + actualConsumerValidatorB, err := providerKeeper.CreateConsumerValidator(ctx, chainID, valB) + expectedConsumerValidatorB := types.ConsumerValidator{ + ProviderConsAddr: valBProviderConsAddr.ToSdkConsAddr(), + Power: 2, + ConsumerPublicKey: &valBPublicKey, + } + require.Equal(t, expectedConsumerValidatorB, actualConsumerValidatorB) + require.NoError(t, err) +} diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index 83812b6eb5..c90fa9a214 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -10,6 +10,7 @@ import ( v3 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v3" v4 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v4" v5 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v5" + v6 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v6" ) // Migrator is a struct for handling in-place store migrations. @@ -46,7 +47,14 @@ func (m Migrator) Migrate3to4(ctx sdktypes.Context) error { } // Migrate4to5 migrates x/ccvprovider state from consensus version 4 to 5. -// The migration consists of initializing new provider chain params using params from the legacy store. +// The migration consists of setting a top N of 95 for all registered consumer chains. func (m Migrator) Migrate4to5(ctx sdktypes.Context) error { - return v5.MigrateLegacyParams(ctx, m.providerKeeper, m.paramSpace) + v5.MigrateTopNForRegisteredChains(ctx, m.providerKeeper) + return nil +} + +// Migrate5to6 migrates x/ccvprovider state from consensus version 5 to 6. +// The migration consists of initializing new provider chain params using params from the legacy store. +func (m Migrator) Migrate5to6(ctx sdktypes.Context) error { + return v6.MigrateLegacyParams(ctx, m.providerKeeper, m.paramSpace) } diff --git a/x/ccv/provider/migrations/v5/migrations.go b/x/ccv/provider/migrations/v5/migrations.go index f61428e48a..aa228b6a09 100644 --- a/x/ccv/provider/migrations/v5/migrations.go +++ b/x/ccv/provider/migrations/v5/migrations.go @@ -4,19 +4,21 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) -// MigrateParams migrates the provider module's parameters from the x/params to self store. -func MigrateLegacyParams(ctx sdk.Context, keeper providerkeeper.Keeper, legacyParamspace ccvtypes.LegacyParamSubspace) error { - ctx.Logger().Info("starting provider legacy params migration") - params := GetParamsLegacy(ctx, legacyParamspace) - err := params.Validate() - if err != nil { - return err - } +// This migration only takes already registered chains into account. +// If a chain is in voting while the upgrade happens, this is not sufficient, +// and a migration to rewrite the proposal is needed. +func MigrateTopNForRegisteredChains(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { + // get all consumer chains + registeredConsumerChains := providerKeeper.GetAllConsumerChains(ctx) - keeper.SetParams(ctx, params) - keeper.Logger(ctx).Info("successfully migrated legacy provider parameters") - return nil + // Set the topN of each chain to 95 + for _, chain := range registeredConsumerChains { + providerKeeper.SetTopN(ctx, chain.ChainId, 95) + } } + +// // If there are consumer addition proposals in the voting period at the upgrade time, they may need the topN value updated. +// func MigrateTopNForVotingPeriodChains(ctx sdk.Context, govKeeper govkeeper.Keeper, providerKeeper providerkeeper.Keeper) { +// } diff --git a/x/ccv/provider/migrations/v5/migrations_test.go b/x/ccv/provider/migrations/v5/migrations_test.go index a7705da8b0..907aa1b019 100644 --- a/x/ccv/provider/migrations/v5/migrations_test.go +++ b/x/ccv/provider/migrations/v5/migrations_test.go @@ -6,52 +6,25 @@ import ( "github.com/stretchr/testify/require" testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" ) func TestMigrateParams(t *testing.T) { - t.Helper() inMemParams := testutil.NewInMemKeeperParams(t) - k, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) + provKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) defer ctrl.Finish() - if !inMemParams.ParamsSubspace.HasKeyTable() { - inMemParams.ParamsSubspace.WithKeyTable(providertypes.ParamKeyTable()) - } - - defaultParams := providertypes.DefaultParams() - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTemplateClient, defaultParams.TemplateClient) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTrustingPeriodFraction, defaultParams.TrustingPeriodFraction) - inMemParams.ParamsSubspace.Set(ctx, ccvtypes.KeyCCVTimeoutPeriod, defaultParams.CcvTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyInitTimeoutPeriod, defaultParams.InitTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyVscTimeoutPeriod, defaultParams.VscTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishPeriod, defaultParams.SlashMeterReplenishPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishFraction, defaultParams.SlashMeterReplenishFraction) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyConsumerRewardDenomRegistrationFee, defaultParams.ConsumerRewardDenomRegistrationFee) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, defaultParams.BlocksPerEpoch) - - // confirms that inMemParams.ParamsSubspace works as expected - require.NotPanics(t, func() { - GetParamsLegacy(ctx, inMemParams.ParamsSubspace) - }) - - // no "new" params should be available before migration - // "new" params are stored under providertypes.ParametersKey() - emptyParams := k.GetParams(ctx) - require.Empty(t, emptyParams) - - // make sure that the legacy params are equal to the default params (they were set using inMemParams.ParamsSubspace.Set()) - legacyParams := GetParamsLegacy(ctx, inMemParams.ParamsSubspace) - require.NotNil(t, legacyParams) - require.Equal(t, defaultParams, legacyParams) - - err := MigrateLegacyParams(ctx, k, inMemParams.ParamsSubspace) - require.NoError(t, err) - - // check that "new" params are available after migration and equal to defaults - migratedParams := k.GetParams(ctx) - require.NotEmpty(t, migratedParams) - require.Equal(t, defaultParams, migratedParams) - require.NotEqual(t, emptyParams, migratedParams) + provKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + + // initially top N should not exist + topN, found := provKeeper.GetTopN(ctx, "chainID") + require.False(t, found) + require.Zero(t, topN) + + // migrate + MigrateTopNForRegisteredChains(ctx, provKeeper) + + // after migration, top N should be 95 + topN, found = provKeeper.GetTopN(ctx, "chainID") + require.True(t, found) + require.Equal(t, uint32(95), topN) } diff --git a/x/ccv/provider/migrations/v5/legacy_params.go b/x/ccv/provider/migrations/v6/legacy_params.go similarity index 99% rename from x/ccv/provider/migrations/v5/legacy_params.go rename to x/ccv/provider/migrations/v6/legacy_params.go index 146339a131..1841497bce 100644 --- a/x/ccv/provider/migrations/v5/legacy_params.go +++ b/x/ccv/provider/migrations/v6/legacy_params.go @@ -1,4 +1,4 @@ -package v5 +package v6 import ( "time" diff --git a/x/ccv/provider/migrations/v6/migration_test.go b/x/ccv/provider/migrations/v6/migration_test.go new file mode 100644 index 0000000000..f66c73301f --- /dev/null +++ b/x/ccv/provider/migrations/v6/migration_test.go @@ -0,0 +1,57 @@ +package v6 + +import ( + "testing" + + "github.com/stretchr/testify/require" + + testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" +) + +func TestMigrateParams(t *testing.T) { + t.Helper() + inMemParams := testutil.NewInMemKeeperParams(t) + k, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + if !inMemParams.ParamsSubspace.HasKeyTable() { + inMemParams.ParamsSubspace.WithKeyTable(providertypes.ParamKeyTable()) + } + + defaultParams := providertypes.DefaultParams() + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTemplateClient, defaultParams.TemplateClient) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTrustingPeriodFraction, defaultParams.TrustingPeriodFraction) + inMemParams.ParamsSubspace.Set(ctx, ccvtypes.KeyCCVTimeoutPeriod, defaultParams.CcvTimeoutPeriod) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyInitTimeoutPeriod, defaultParams.InitTimeoutPeriod) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyVscTimeoutPeriod, defaultParams.VscTimeoutPeriod) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishPeriod, defaultParams.SlashMeterReplenishPeriod) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishFraction, defaultParams.SlashMeterReplenishFraction) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyConsumerRewardDenomRegistrationFee, defaultParams.ConsumerRewardDenomRegistrationFee) + inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, defaultParams.BlocksPerEpoch) + + // confirms that inMemParams.ParamsSubspace works as expected + require.NotPanics(t, func() { + GetParamsLegacy(ctx, inMemParams.ParamsSubspace) + }) + + // no "new" params should be available before migration + // "new" params are stored under providertypes.ParametersKey() + emptyParams := k.GetParams(ctx) + require.Empty(t, emptyParams) + + // make sure that the legacy params are equal to the default params (they were set using inMemParams.ParamsSubspace.Set()) + legacyParams := GetParamsLegacy(ctx, inMemParams.ParamsSubspace) + require.NotNil(t, legacyParams) + require.Equal(t, defaultParams, legacyParams) + + err := MigrateLegacyParams(ctx, k, inMemParams.ParamsSubspace) + require.NoError(t, err) + + // check that "new" params are available after migration and equal to defaults + migratedParams := k.GetParams(ctx) + require.NotEmpty(t, migratedParams) + require.Equal(t, defaultParams, migratedParams) + require.NotEqual(t, emptyParams, migratedParams) +} diff --git a/x/ccv/provider/migrations/v6/migrations.go b/x/ccv/provider/migrations/v6/migrations.go new file mode 100644 index 0000000000..3f90e32d9d --- /dev/null +++ b/x/ccv/provider/migrations/v6/migrations.go @@ -0,0 +1,21 @@ +package v6 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" +) + +// MigrateParams migrates the provider module's parameters from the x/params to self store. +func MigrateLegacyParams(ctx sdk.Context, keeper providerkeeper.Keeper, legacyParamspace ccvtypes.LegacyParamSubspace) error { + ctx.Logger().Info("starting provider legacy params migration") + params := GetParamsLegacy(ctx, legacyParamspace) + err := params.Validate() + if err != nil { + return err + } + + keeper.SetParams(ctx, params) + keeper.Logger(ctx).Info("successfully migrated legacy provider parameters") + return nil +} diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 63e26431fc..d670ee2828 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -131,6 +131,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(providertypes.ModuleName, 4, migrator.Migrate4to5); err != nil { panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 4 -> 5", providertypes.ModuleName, err)) } + if err := cfg.RegisterMigration(providertypes.ModuleName, 5, migrator.Migrate5to6); err != nil { + panic(fmt.Sprintf("failed to register migrator for %s: %s", providertypes.ModuleName, err)) + } } // InitGenesis performs genesis initialization for the provider module. It returns no validator updates. @@ -151,7 +154,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 5 } +func (AppModule) ConsensusVersion() uint64 { return 6 } // BeginBlock implements the AppModule interface func (am AppModule) BeginBlock(ctx context.Context) error { @@ -162,6 +165,8 @@ func (am AppModule) BeginBlock(ctx context.Context) error { am.keeper.BeginBlockCCR(sdkCtx) // Check for replenishing slash meter before any slash packets are processed for this block am.keeper.BeginBlockCIS(sdkCtx) + // BeginBlock logic needed for the Reward Distribution sub-protocol + am.keeper.BeginBlockRD(sdkCtx) return nil } @@ -177,8 +182,6 @@ func (am AppModule) EndBlock(ctx context.Context) error { am.keeper.EndBlockCCR(sdkCtx) // EndBlock logic needed for the Validator Set Update sub-protocol am.keeper.EndBlockVSU(sdkCtx) - // EndBlock logic need for the Reward Distribution sub-protocol - am.keeper.EndBlockRD(sdkCtx) return nil } diff --git a/x/ccv/provider/proposal_handler.go b/x/ccv/provider/proposal_handler.go index 6c6f78b792..40a551d185 100644 --- a/x/ccv/provider/proposal_handler.go +++ b/x/ccv/provider/proposal_handler.go @@ -21,6 +21,8 @@ func NewProviderProposalHandler(k keeper.Keeper) govv1beta1.Handler { return k.HandleLegacyConsumerAdditionProposal(ctx, c) case *types.ConsumerRemovalProposal: return k.HandleLegacyConsumerRemovalProposal(ctx, c) + case *types.ConsumerModificationProposal: + return k.HandleLegacyConsumerModificationProposal(ctx, c) case *types.ChangeRewardDenomsProposal: return k.HandleLegacyConsumerRewardDenomProposal(ctx, c) default: diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 2112bb8d33..c72bc44505 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -45,6 +45,11 @@ func TestProviderProposalHandler(t *testing.T) { 100000000000, 100000000000, 100000000000, + 0, + 0, + 0, + nil, + nil, ), blockTime: hourFromNow, // ctx blocktime is after proposal's spawn time expValidConsumerAddition: true, @@ -92,6 +97,7 @@ func TestProviderProposalHandler(t *testing.T) { // Mock expectations depending on expected outcome switch { case tc.expValidConsumerAddition: + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Times(1) gomock.InOrder(testkeeper.GetMocksForCreateConsumerClient( ctx, &mocks, "chainID", clienttypes.NewHeight(2, 3), )...) diff --git a/x/ccv/provider/types/codec.go b/x/ccv/provider/types/codec.go index 2966cebf5d..1d75778bb1 100644 --- a/x/ccv/provider/types/codec.go +++ b/x/ccv/provider/types/codec.go @@ -23,6 +23,10 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*govv1beta1.Content)(nil), &ConsumerRemovalProposal{}, ) + registry.RegisterImplementations( + (*govv1beta1.Content)(nil), + &ConsumerModificationProposal{}, + ) registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgAssignConsumerKey{}, @@ -48,10 +52,22 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*sdk.Msg)(nil), &MsgSubmitConsumerDoubleVoting{}, ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgOptIn{}, + ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgOptOut{}, + ) registry.RegisterImplementations( (*exported.ClientMessage)(nil), &tendermint.Misbehaviour{}, ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSetConsumerCommissionRate{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index 257ad037c0..7cee0716ba 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -6,27 +6,30 @@ import ( // Provider sentinel errors var ( - ErrInvalidConsumerAdditionProposal = errorsmod.Register(ModuleName, 1, "invalid consumer addition proposal") - ErrInvalidConsumerRemovalProp = errorsmod.Register(ModuleName, 2, "invalid consumer removal proposal") - ErrUnknownConsumerChainId = errorsmod.Register(ModuleName, 3, "no consumer chain with this chain id") - ErrUnknownConsumerChannelId = errorsmod.Register(ModuleName, 4, "no consumer chain with this channel id") - ErrInvalidConsumerConsensusPubKey = errorsmod.Register(ModuleName, 5, "empty consumer consensus public key") - ErrInvalidConsumerChainID = errorsmod.Register(ModuleName, 6, "invalid consumer chain id") - ErrConsumerKeyNotFound = errorsmod.Register(ModuleName, 7, "consumer key not found") - ErrNoValidatorConsumerAddress = errorsmod.Register(ModuleName, 8, "error getting validator consumer address") - ErrNoValidatorProviderAddress = errorsmod.Register(ModuleName, 9, "error getting validator provider address") - ErrConsumerKeyInUse = errorsmod.Register(ModuleName, 10, "consumer key is already in use by a validator") - ErrCannotAssignDefaultKeyAssignment = errorsmod.Register(ModuleName, 11, "cannot re-assign default key assignment") - ErrInvalidConsumerParams = errorsmod.Register(ModuleName, 12, "invalid consumer params") - ErrInvalidProviderAddress = errorsmod.Register(ModuleName, 13, "invalid provider address") - ErrInvalidConsumerRewardDenom = errorsmod.Register(ModuleName, 14, "invalid consumer reward denom") - ErrInvalidDepositorAddress = errorsmod.Register(ModuleName, 15, "invalid depositor address") - ErrInvalidConsumerClient = errorsmod.Register(ModuleName, 16, "ccv channel is not built on correct client") - ErrDuplicateConsumerChain = errorsmod.Register(ModuleName, 17, "consumer chain already exists") - ErrConsumerChainNotFound = errorsmod.Register(ModuleName, 18, "consumer chain not found") - ErrNoUnconfirmedVSCPacket = errorsmod.Register(ModuleName, 19, "no unconfirmed vsc packet for this chain id") - ErrNoUnbondingTime = errorsmod.Register(ModuleName, 20, "provider unbonding time not found") - ErrInvalidAddress = errorsmod.Register(ModuleName, 21, "invalid address") - ErrUnauthorized = errorsmod.Register(ModuleName, 22, "unauthorized") - ErrBlankConsumerChainID = errorsmod.Register(ModuleName, 23, "consumer chain id must not be blank") + ErrInvalidConsumerAdditionProposal = errorsmod.Register(ModuleName, 1, "invalid consumer addition proposal") + ErrInvalidConsumerRemovalProp = errorsmod.Register(ModuleName, 2, "invalid consumer removal proposal") + ErrUnknownConsumerChainId = errorsmod.Register(ModuleName, 3, "no consumer chain with this chain id") + ErrUnknownConsumerChannelId = errorsmod.Register(ModuleName, 4, "no consumer chain with this channel id") + ErrInvalidConsumerConsensusPubKey = errorsmod.Register(ModuleName, 5, "empty consumer consensus public key") + ErrInvalidConsumerChainID = errorsmod.Register(ModuleName, 6, "invalid consumer chain id") + ErrConsumerKeyNotFound = errorsmod.Register(ModuleName, 7, "consumer key not found") + ErrNoValidatorConsumerAddress = errorsmod.Register(ModuleName, 8, "error getting validator consumer address") + ErrNoValidatorProviderAddress = errorsmod.Register(ModuleName, 9, "error getting validator provider address") + ErrConsumerKeyInUse = errorsmod.Register(ModuleName, 10, "consumer key is already in use by a validator") + ErrCannotAssignDefaultKeyAssignment = errorsmod.Register(ModuleName, 11, "cannot re-assign default key assignment") + ErrInvalidConsumerParams = errorsmod.Register(ModuleName, 12, "invalid consumer params") + ErrInvalidProviderAddress = errorsmod.Register(ModuleName, 13, "invalid provider address") + ErrInvalidConsumerRewardDenom = errorsmod.Register(ModuleName, 14, "invalid consumer reward denom") + ErrInvalidDepositorAddress = errorsmod.Register(ModuleName, 15, "invalid depositor address") + ErrInvalidConsumerClient = errorsmod.Register(ModuleName, 16, "ccv channel is not built on correct client") + ErrDuplicateConsumerChain = errorsmod.Register(ModuleName, 17, "consumer chain already exists") + ErrConsumerChainNotFound = errorsmod.Register(ModuleName, 18, "consumer chain not found") + ErrInvalidConsumerCommissionRate = errorsmod.Register(ModuleName, 19, "consumer commission rate is invalid") + ErrCannotOptOutFromTopN = errorsmod.Register(ModuleName, 20, "cannot opt out from a Top N chain") + ErrNoUnconfirmedVSCPacket = errorsmod.Register(ModuleName, 21, "no unconfirmed vsc packet for this chain id") + ErrInvalidConsumerModificationProposal = errorsmod.Register(ModuleName, 23, "invalid consumer modification proposal") + ErrNoUnbondingTime = errorsmod.Register(ModuleName, 24, "provider unbonding time not found") + ErrInvalidAddress = errorsmod.Register(ModuleName, 25, "invalid address") + ErrUnauthorized = errorsmod.Register(ModuleName, 26, "unauthorized") + ErrBlankConsumerChainID = errorsmod.Register(ModuleName, 27, "consumer chain id must not be blank") ) diff --git a/x/ccv/provider/types/events.go b/x/ccv/provider/types/events.go index 58d686020f..8701821c52 100644 --- a/x/ccv/provider/types/events.go +++ b/x/ccv/provider/types/events.go @@ -7,6 +7,9 @@ const ( EventTypeAddConsumerRewardDenom = "add_consumer_reward_denom" EventTypeRemoveConsumerRewardDenom = "remove_consumer_reward_denom" EventTypeExecuteConsumerChainSlash = "execute_consumer_chain_slash" + EventTypeSetConsumerCommissionRate = "set_consumer_commission_rate" + EventTypeOptIn = "opt_in" + EventTypeOptOut = "opt_out" AttributeInfractionHeight = "infraction_height" AttributeInitialHeight = "initial_height" AttributeInitializationTimeout = "initialization_timeout" @@ -15,4 +18,6 @@ const ( AttributeProviderValidatorAddress = "provider_validator_address" AttributeConsumerConsensusPubKey = "consumer_consensus_pub_key" AttributeConsumerRewardDenom = "consumer_reward_denom" + AttributeConsumerCommissionRate = "consumer_commission_rate" + AttributeConsumerChainID = "consumer_chain_id" ) diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 337638f55c..051ad4c1be 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -147,11 +147,42 @@ const ( // ProposedConsumerChainByteKey is the byte prefix storing the consumer chainId in consumerAddition gov proposal submitted before voting finishes ProposedConsumerChainByteKey - // ConsumerValidatorBytePrefix is the byte prefix used when storing for each consumer chain all the consumer validators in this epoch + // ConsumerValidatorBytePrefix is the byte prefix used when storing for each consumer chain all the consumer + // validators in this epoch that are validating the consumer chain ConsumerValidatorBytePrefix - // ParametersKey is the is the single byte key for storing provider's parameters. - ParametersByteKey + // OptedInBytePrefix is the byte prefix for storing whether a validator is opted in to validate on a consumer chain + OptedInBytePrefix + + // TopNBytePrefix is the byte prefix storing the mapping from a consumer chain to the N value of this chain, + // that corresponds to the N% of the top validators that have to validate this consumer chain + TopNBytePrefix + + // ValidatorsPowerCapPrefix is the byte prefix storing the mapping from a consumer chain to the power-cap value of this chain, + // that corresponds to p% such that no validator can have more than p% of the voting power on the consumer chain. + // Operates on a best-effort basis. + ValidatorsPowerCapPrefix + + // ValidatorSetCapPrefix is the byte prefix storing the mapping from a consumer chain to the validator-set cap value + // of this chain. + ValidatorSetCapPrefix + + // AllowlistPrefix is the byte prefix storing the mapping from a consumer chain to the set of validators that are + // allowlisted. + AllowlistPrefix + + // DenylistPrefix is the byte prefix storing the mapping from a consumer chain to the set of validators that are + // denylisted. + DenylistPrefix + + // ConsumerRewardsAllocationBytePrefix is the byte prefix for storing for each consumer the ICS rewards + // allocated to the consumer rewards pool + ConsumerRewardsAllocationBytePrefix + + // ConsumerCommissionRatePrefix is the byte prefix for storing the commission rate + // per validator per consumer chain + ConsumerCommissionRatePrefix + // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -159,6 +190,13 @@ const ( // Fully defined key func section // +const ( + // ParametersKey is the is the single byte key for storing provider's parameters. + // note that this was set to the max uint8 type value 0xFF in order to protect + // from using the ICS v5.0.0 provider module by mistake + ParametersByteKey = byte(0xFF) +) + // ParametersKey returns the key for the parameters of the provider module in the store func ParametersKey() []byte { return []byte{ParametersByteKey} @@ -529,6 +567,52 @@ func ConsumerValidatorKey(chainID string, providerAddr []byte) []byte { return append(prefix, providerAddr...) } +// TopNKey returns the key used to store the Top N value per consumer chain. +// This value corresponds to the N% of the top validators that have to validate the consumer chain. +func TopNKey(chainID string) []byte { + return ChainIdWithLenKey(TopNBytePrefix, chainID) +} + +// ValidatorSetPowerKey returns the key of consumer chain `chainID` +func ValidatorsPowerCapKey(chainID string) []byte { + return ChainIdWithLenKey(ValidatorsPowerCapPrefix, chainID) +} + +// ValidatorSetCapKey returns the key of consumer chain `chainID` +func ValidatorSetCapKey(chainID string) []byte { + return ChainIdWithLenKey(ValidatorSetCapPrefix, chainID) +} + +// AllowlistCapKey returns the key to a validator's slash log +func AllowlistCapKey(chainID string, providerAddr ProviderConsAddress) []byte { + return append(ChainIdWithLenKey(AllowlistPrefix, chainID), providerAddr.ToSdkConsAddr().Bytes()...) +} + +// DenylistCapKey returns the key to a validator's slash log +func DenylistCapKey(chainID string, providerAddr ProviderConsAddress) []byte { + return append(ChainIdWithLenKey(DenylistPrefix, chainID), providerAddr.ToSdkConsAddr().Bytes()...) +} + +// OptedInKey returns the key used to store whether a validator is opted in on a consumer chain. +func OptedInKey(chainID string, providerAddr ProviderConsAddress) []byte { + prefix := ChainIdWithLenKey(OptedInBytePrefix, chainID) + return append(prefix, providerAddr.ToSdkConsAddr().Bytes()...) +} + +// ConsumerRewardsAllocationKey returns the key used to store the ICS rewards per consumer chain +func ConsumerRewardsAllocationKey(chainID string) []byte { + return append([]byte{ConsumerRewardsAllocationBytePrefix}, []byte(chainID)...) +} + +// ConsumerCommissionRateKey returns the key used to store the commission rate per validator per consumer chain. +func ConsumerCommissionRateKey(chainID string, providerAddr ProviderConsAddress) []byte { + return ChainIdAndConsAddrKey( + ConsumerCommissionRatePrefix, + chainID, + providerAddr.ToSdkConsAddr(), + ) +} + // // End of generic helpers section // diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index bfe4f55f61..2159777d2b 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -57,6 +57,10 @@ func getAllKeyPrefixes() []byte { providertypes.EquivocationEvidenceMinHeightBytePrefix, providertypes.ProposedConsumerChainByteKey, providertypes.ConsumerValidatorBytePrefix, + providertypes.OptedInBytePrefix, + providertypes.TopNBytePrefix, + providertypes.ConsumerRewardsAllocationBytePrefix, + providertypes.ConsumerCommissionRatePrefix, providertypes.ParametersByteKey, } } diff --git a/x/ccv/provider/types/legacy_proposal.go b/x/ccv/provider/types/legacy_proposal.go index 4076e37ed7..21d46b19e5 100644 --- a/x/ccv/provider/types/legacy_proposal.go +++ b/x/ccv/provider/types/legacy_proposal.go @@ -19,15 +19,17 @@ import ( ) const ( - ProposalTypeConsumerAddition = "ConsumerAddition" - ProposalTypeConsumerRemoval = "ConsumerRemoval" - ProposalTypeEquivocation = "Equivocation" - ProposalTypeChangeRewardDenoms = "ChangeRewardDenoms" + ProposalTypeConsumerAddition = "ConsumerAddition" + ProposalTypeConsumerRemoval = "ConsumerRemoval" + ProposalTypeConsumerModification = "ConsumerModification" + ProposalTypeEquivocation = "Equivocation" + ProposalTypeChangeRewardDenoms = "ChangeRewardDenoms" ) var ( _ govv1beta1.Content = &ConsumerAdditionProposal{} _ govv1beta1.Content = &ConsumerRemovalProposal{} + _ govv1beta1.Content = &ConsumerModificationProposal{} _ govv1beta1.Content = &ChangeRewardDenomsProposal{} _ govv1beta1.Content = &EquivocationProposal{} ) @@ -35,6 +37,7 @@ var ( func init() { govv1beta1.RegisterProposalType(ProposalTypeConsumerAddition) govv1beta1.RegisterProposalType(ProposalTypeConsumerRemoval) + govv1beta1.RegisterProposalType(ProposalTypeConsumerModification) govv1beta1.RegisterProposalType(ProposalTypeChangeRewardDenoms) govv1beta1.RegisterProposalType(ProposalTypeEquivocation) } @@ -50,6 +53,11 @@ func NewConsumerAdditionProposal(title, description, chainID string, ccvTimeoutPeriod time.Duration, transferTimeoutPeriod time.Duration, unbondingPeriod time.Duration, + topN uint32, + validatorsPowerCap uint32, + validatorSetCap uint32, + allowlist []string, + denylist []string, ) govv1beta1.Content { return &ConsumerAdditionProposal{ Title: title, @@ -66,6 +74,11 @@ func NewConsumerAdditionProposal(title, description, chainID string, CcvTimeoutPeriod: ccvTimeoutPeriod, TransferTimeoutPeriod: transferTimeoutPeriod, UnbondingPeriod: unbondingPeriod, + Top_N: topN, + ValidatorsPowerCap: validatorsPowerCap, + ValidatorSetCap: validatorSetCap, + Allowlist: allowlist, + Denylist: denylist, } } @@ -83,6 +96,21 @@ func (cccp *ConsumerAdditionProposal) ProposalType() string { return ProposalTypeConsumerAddition } +// ValidatePSSFeatures returns an error if the `topN` and `validatorsPowerCap` parameters are no in the correct ranges +func ValidatePSSFeatures(topN uint32, validatorsPowerCap uint32) error { + // Top N corresponds to the top N% of validators that have to validate the consumer chain and can only be 0 (for an + // Opt In chain) or in the range [50, 100] (for a Top N chain). + if topN != 0 && (topN < 50 || topN > 100) { + return fmt.Errorf("Top N can either be 0 or in the range [50, 100]") + } + + if validatorsPowerCap != 0 && validatorsPowerCap > 100 { + return fmt.Errorf("validators' power cap has to be in the range [1, 100]") + } + + return nil +} + // ValidateBasic runs basic stateless validity checks func (cccp *ConsumerAdditionProposal) ValidateBasic() error { if err := govv1beta1.ValidateAbstract(cccp); err != nil { @@ -136,6 +164,10 @@ func (cccp *ConsumerAdditionProposal) ValidateBasic() error { return errorsmod.Wrap(ErrInvalidConsumerAdditionProposal, "unbonding period cannot be zero") } + err := ValidatePSSFeatures(cccp.Top_N, cccp.ValidatorsPowerCap) + if err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerAdditionProposal, "invalid PSS features: %s", err.Error()) + } return nil } @@ -204,6 +236,51 @@ func (sccp *ConsumerRemovalProposal) ValidateBasic() error { return nil } +// NewConsumerModificationProposal creates a new consumer modificaton proposal. +func NewConsumerModificationProposal(title, description, chainID string, + topN uint32, + validatorsPowerCap uint32, + validatorSetCap uint32, + allowlist []string, + denylist []string, +) govv1beta1.Content { + return &ConsumerModificationProposal{ + Title: title, + Description: description, + ChainId: chainID, + Top_N: topN, + ValidatorsPowerCap: validatorsPowerCap, + ValidatorSetCap: validatorSetCap, + Allowlist: allowlist, + Denylist: denylist, + } +} + +// ProposalRoute returns the routing key of a consumer modification proposal. +func (cccp *ConsumerModificationProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of the consumer modification proposal. +func (cccp *ConsumerModificationProposal) ProposalType() string { + return ProposalTypeConsumerModification +} + +// ValidateBasic runs basic stateless validity checks +func (cccp *ConsumerModificationProposal) ValidateBasic() error { + if err := govv1beta1.ValidateAbstract(cccp); err != nil { + return err + } + + if strings.TrimSpace(cccp.ChainId) == "" { + return errorsmod.Wrap(ErrInvalidConsumerModificationProposal, "consumer chain id must not be blank") + } + + err := ValidatePSSFeatures(cccp.Top_N, cccp.ValidatorsPowerCap) + if err != nil { + return errorsmod.Wrapf(ErrInvalidConsumerModificationProposal, "invalid PSS features: %s", err.Error()) + } + return nil +} + // NewEquivocationProposal creates a new equivocation proposal. // [DEPRECATED]: do not use because equivocations can be submitted // and verified automatically on the provider. diff --git a/x/ccv/provider/types/legacy_proposal_test.go b/x/ccv/provider/types/legacy_proposal_test.go index 8253af35cf..729a4318ca 100644 --- a/x/ccv/provider/types/legacy_proposal_test.go +++ b/x/ccv/provider/types/legacy_proposal_test.go @@ -36,6 +36,11 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 100000000000, 100000000000, 100000000000, + 0, + 0, + 0, + nil, + nil, ), true, }, @@ -48,7 +53,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), true, }, { @@ -60,7 +71,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -72,7 +89,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -104,7 +127,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -116,7 +145,12 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil), false, }, { @@ -128,7 +162,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -140,7 +180,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -152,7 +198,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 100000000000, 10000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -164,7 +216,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -176,7 +234,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { -2, 100000000000, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -188,7 +252,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 0, 100000000000, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -200,7 +270,13 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 0, - 100000000000), + 100000000000, + 0, + 0, + 0, + nil, + nil, + ), false, }, { @@ -212,9 +288,69 @@ func TestConsumerAdditionProposalValidateBasic(t *testing.T) { 10000, 100000000000, 100000000000, - 0), + 0, + 0, + 0, + 0, + nil, + nil, + ), + false, + }, + { + "top N is invalid", + types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), + "0.75", + 10, + "", + 10000, + 100000000000, + 100000000000, + 100000000000, + 10, + 0, + 0, + nil, + nil, + ), + false, + }, + { + "validators power cap is invalid", + types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), + "0.75", + 10, + "", + 10000, + 100000000000, + 100000000000, + 100000000000, + 50, + 101, + 0, + nil, + nil, + ), false, }, + { + "valid proposal with PSS features", + types.NewConsumerAdditionProposal("title", "description", "chainID", initialHeight, []byte("gen_hash"), []byte("bin_hash"), time.Now(), + "0.75", + 10, + "", + 10000, + 100000000000, + 100000000000, + 100000000000, + 0, + 34, + 101, + []string{"addr1"}, + []string{"addr2", "addr3"}, + ), + true, + }, } for _, tc := range testCases { @@ -236,7 +372,12 @@ func TestMarshalConsumerAdditionProposal(t *testing.T) { 10000, 100000000000, 100000000000, - 100000000000) + 100000000000, + 0, + 0, + 0, + nil, + nil) cccp, ok := content.(*types.ConsumerAdditionProposal) require.True(t, ok) @@ -278,7 +419,12 @@ func TestConsumerAdditionProposalString(t *testing.T) { 500000, 100000000000, 10000000000, - 100000000000) + 100000000000, + 0, + 0, + 0, + []string{}, + []string{}) expect := fmt.Sprintf(`CreateConsumerChain Proposal Title: title @@ -354,3 +500,91 @@ func TestChangeRewardDenomsProposalValidateBasic(t *testing.T) { }) } } + +func TestConsumerModificationProposalValidateBasic(t *testing.T) { + testCases := []struct { + name string + proposal govv1beta1.Content + expPass bool + }{ + { + "success", + types.NewConsumerModificationProposal("title", "description", "chainID", + 50, + 100, + 34, + []string{"addr1"}, + nil, + ), + true, + }, + { + "invalid chain id", + types.NewConsumerModificationProposal("title", "description", " ", + 0, + 0, + 0, + nil, + nil, + ), + false, + }, + { + "top N is invalid", + types.NewConsumerModificationProposal("title", "description", "chainID", + 10, + 0, + 0, + nil, + nil, + ), + false, + }, + { + "validators power cap is invalid", + types.NewConsumerModificationProposal("title", "description", "chainID", + 50, + 101, + 0, + nil, + nil, + ), + false, + }, + { + "valid proposal", + types.NewConsumerModificationProposal("title", "description", "chainID", + 0, + 34, + 101, + []string{"addr1"}, + []string{"addr2", "addr3"}, + ), + true, + }, + } + + for _, tc := range testCases { + + err := tc.proposal.ValidateBasic() + if tc.expPass { + require.NoError(t, err, "valid case: %s should not return error. got %w", tc.name, err) + } else { + require.Error(t, err, "invalid case: '%s' must return error but got none", tc.name) + } + } +} + +func TestValidatePSSFeatures(t *testing.T) { + require.NoError(t, types.ValidatePSSFeatures(0, 0)) + require.NoError(t, types.ValidatePSSFeatures(50, 0)) + require.NoError(t, types.ValidatePSSFeatures(100, 0)) + require.NoError(t, types.ValidatePSSFeatures(0, 10)) + require.NoError(t, types.ValidatePSSFeatures(0, 100)) + require.NoError(t, types.ValidatePSSFeatures(50, 100)) + + require.Error(t, types.ValidatePSSFeatures(10, 0)) + require.Error(t, types.ValidatePSSFeatures(49, 0)) + require.Error(t, types.ValidatePSSFeatures(101, 0)) + require.Error(t, types.ValidatePSSFeatures(50, 101)) +} diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index d7b9d14c12..77ce3c7326 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -23,6 +23,9 @@ const ( TypeMsgAssignConsumerKey = "assign_consumer_key" TypeMsgSubmitConsumerMisbehaviour = "submit_consumer_misbehaviour" TypeMsgSubmitConsumerDoubleVoting = "submit_consumer_double_vote" + TypeMsgOptIn = "opt_in" + TypeMsgOptOut = "opt_out" + TypeMsgSetConsumerCommissionRate = "set_consumer_commission_rate" ) var ( @@ -32,6 +35,9 @@ var ( _ sdk.Msg = (*MsgChangeRewardDenoms)(nil) _ sdk.Msg = (*MsgSubmitConsumerMisbehaviour)(nil) _ sdk.Msg = (*MsgSubmitConsumerDoubleVoting)(nil) + _ sdk.Msg = (*MsgOptIn)(nil) + _ sdk.Msg = (*MsgOptOut)(nil) + _ sdk.Msg = (*MsgSetConsumerCommissionRate)(nil) _ sdk.HasValidateBasic = (*MsgAssignConsumerKey)(nil) _ sdk.HasValidateBasic = (*MsgConsumerAddition)(nil) @@ -39,6 +45,9 @@ var ( _ sdk.HasValidateBasic = (*MsgChangeRewardDenoms)(nil) _ sdk.HasValidateBasic = (*MsgSubmitConsumerMisbehaviour)(nil) _ sdk.HasValidateBasic = (*MsgSubmitConsumerDoubleVoting)(nil) + _ sdk.HasValidateBasic = (*MsgOptIn)(nil) + _ sdk.HasValidateBasic = (*MsgOptOut)(nil) + _ sdk.HasValidateBasic = (*MsgSetConsumerCommissionRate)(nil) ) // NewMsgAssignConsumerKey creates a new MsgAssignConsumerKey instance. @@ -297,6 +306,146 @@ func (msg *MsgConsumerRemoval) ValidateBasic() error { return nil } +// NewMsgOptIn creates a new NewMsgOptIn instance. +func NewMsgOptIn(chainID string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey string) (*MsgOptIn, error) { + return &MsgOptIn{ + ChainId: chainID, + ProviderAddr: providerValidatorAddress.String(), + ConsumerKey: consumerConsensusPubKey, + }, nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgOptIn) Type() string { + return TypeMsgOptIn +} + +// Route implements the sdk.Msg interface. +func (msg MsgOptIn) Route() string { return RouterKey } + +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +func (msg MsgOptIn) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgOptIn) ValidateBasic() error { + if strings.TrimSpace(msg.ChainId) == "" { + return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") + } + // It is possible to opt in to validate on consumer chains that are not yet approved. + // This can only be done by a signing validator, but it is still sensible + // to limit the chainID size to prevent abuse. + if 128 < len(msg.ChainId) { + return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") + } + _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + return ErrInvalidProviderAddress + } + + if msg.ConsumerKey != "" { + if _, _, err := ParseConsumerKeyFromJson(msg.ConsumerKey); err != nil { + return ErrInvalidConsumerConsensusPubKey + } + } + return nil +} + +// NewMsgOptOut creates a new NewMsgOptIn instance. +func NewMsgOptOut(chainID string, providerValidatorAddress sdk.ValAddress) (*MsgOptOut, error) { + return &MsgOptOut{ + ChainId: chainID, + ProviderAddr: providerValidatorAddress.String(), + }, nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgOptOut) Type() string { + return TypeMsgOptOut +} + +// Route implements the sdk.Msg interface. +func (msg MsgOptOut) Route() string { return RouterKey } + +// GetSigners implements the sdk.Msg interface. It returns the address(es) that +// must sign over msg.GetSignBytes(). +func (msg MsgOptOut) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgOptOut) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgOptOut) ValidateBasic() error { + if strings.TrimSpace(msg.ChainId) == "" { + return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") + } + // It is possible to assign keys for consumer chains that are not yet approved. + // This can only be done by a signing validator, but it is still sensible + // to limit the chainID size to prevent abuse. + if 128 < len(msg.ChainId) { + return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") + } + _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + return ErrInvalidProviderAddress + } + return nil +} + +// NewMsgSetConsumerCommissionRate creates a new MsgSetConsumerCommissionRate msg instance. +func NewMsgSetConsumerCommissionRate(chainID string, commission math.LegacyDec, providerValidatorAddress sdk.ValAddress) *MsgSetConsumerCommissionRate { + return &MsgSetConsumerCommissionRate{ + ChainId: chainID, + Rate: commission, + ProviderAddr: providerValidatorAddress.String(), + } +} + +func (msg MsgSetConsumerCommissionRate) Route() string { + return RouterKey +} + +func (msg MsgSetConsumerCommissionRate) Type() string { + return TypeMsgSetConsumerCommissionRate +} + +func (msg MsgSetConsumerCommissionRate) ValidateBasic() error { + if strings.TrimSpace(msg.ChainId) == "" { + return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot be blank") + } + + if 128 < len(msg.ChainId) { + return errorsmod.Wrapf(ErrInvalidConsumerChainID, "chainId cannot exceed 128 length") + } + _, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + return ErrInvalidProviderAddress + } + + if msg.Rate.IsNegative() || msg.Rate.GT(math.LegacyOneDec()) { + return errorsmod.Wrapf(ErrInvalidConsumerCommissionRate, "consumer commission rate should be in the range [0, 1]") + } + + return nil +} + func (msg *MsgChangeRewardDenoms) ValidateBasic() error { emptyDenomsToAdd := len(msg.DenomsToAdd) == 0 emptyDenomsToRemove := len(msg.DenomsToRemove) == 0 @@ -330,3 +479,17 @@ func (msg *MsgChangeRewardDenoms) ValidateBasic() error { return nil } + +func (msg MsgSetConsumerCommissionRate) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.ProviderAddr) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +func (msg MsgSetConsumerCommissionRate) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 2c9514c712..dbada484bc 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -8,7 +8,9 @@ import ( fmt "fmt" crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types2 "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" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" @@ -92,6 +94,25 @@ type ConsumerAdditionProposal struct { // chain. it is most relevant for chains performing a sovereign to consumer // changeover in order to maintain the existing ibc transfer channel DistributionTransmissionChannel string `protobuf:"bytes,14,opt,name=distribution_transmission_channel,json=distributionTransmissionChannel,proto3" json:"distribution_transmission_channel,omitempty"` + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + Top_N uint32 `protobuf:"varint,15,opt,name=top_N,json=topN,proto3" json:"top_N,omitempty"` + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + ValidatorsPowerCap uint32 `protobuf:"varint,16,opt,name=validators_power_cap,json=validatorsPowerCap,proto3" json:"validators_power_cap,omitempty"` + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + ValidatorSetCap uint32 `protobuf:"varint,17,opt,name=validator_set_cap,json=validatorSetCap,proto3" json:"validator_set_cap,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + Allowlist []string `protobuf:"bytes,18,rep,name=allowlist,proto3" json:"allowlist,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + Denylist []string `protobuf:"bytes,19,rep,name=denylist,proto3" json:"denylist,omitempty"` } func (m *ConsumerAdditionProposal) Reset() { *m = ConsumerAdditionProposal{} } @@ -204,6 +225,125 @@ func (m *ConsumerRemovalProposal) GetStopTime() time.Time { return time.Time{} } +// ConsumerModificationProposal is a governance proposal on the provider chain to modify parameters of a running +// consumer chain. If it passes, the consumer chain's state is updated to take into account the newest params. +type ConsumerModificationProposal struct { + // the title of the proposal + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // the description of the proposal + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // the chain-id of the consumer chain to be modified + ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + Top_N uint32 `protobuf:"varint,4,opt,name=top_N,json=topN,proto3" json:"top_N,omitempty"` + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + ValidatorsPowerCap uint32 `protobuf:"varint,5,opt,name=validators_power_cap,json=validatorsPowerCap,proto3" json:"validators_power_cap,omitempty"` + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + ValidatorSetCap uint32 `protobuf:"varint,6,opt,name=validator_set_cap,json=validatorSetCap,proto3" json:"validator_set_cap,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + Allowlist []string `protobuf:"bytes,7,rep,name=allowlist,proto3" json:"allowlist,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + Denylist []string `protobuf:"bytes,8,rep,name=denylist,proto3" json:"denylist,omitempty"` +} + +func (m *ConsumerModificationProposal) Reset() { *m = ConsumerModificationProposal{} } +func (m *ConsumerModificationProposal) String() string { return proto.CompactTextString(m) } +func (*ConsumerModificationProposal) ProtoMessage() {} +func (*ConsumerModificationProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{2} +} +func (m *ConsumerModificationProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerModificationProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerModificationProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerModificationProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerModificationProposal.Merge(m, src) +} +func (m *ConsumerModificationProposal) XXX_Size() int { + return m.Size() +} +func (m *ConsumerModificationProposal) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerModificationProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerModificationProposal proto.InternalMessageInfo + +func (m *ConsumerModificationProposal) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *ConsumerModificationProposal) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *ConsumerModificationProposal) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *ConsumerModificationProposal) GetTop_N() uint32 { + if m != nil { + return m.Top_N + } + return 0 +} + +func (m *ConsumerModificationProposal) GetValidatorsPowerCap() uint32 { + if m != nil { + return m.ValidatorsPowerCap + } + return 0 +} + +func (m *ConsumerModificationProposal) GetValidatorSetCap() uint32 { + if m != nil { + return m.ValidatorSetCap + } + return 0 +} + +func (m *ConsumerModificationProposal) GetAllowlist() []string { + if m != nil { + return m.Allowlist + } + return nil +} + +func (m *ConsumerModificationProposal) GetDenylist() []string { + if m != nil { + return m.Denylist + } + return nil +} + // EquivocationProposal is a governance proposal on the provider chain to // punish a validator for equivocation on a consumer chain. // @@ -225,7 +365,7 @@ func (m *EquivocationProposal) Reset() { *m = EquivocationProposal{} } func (m *EquivocationProposal) String() string { return proto.CompactTextString(m) } func (*EquivocationProposal) ProtoMessage() {} func (*EquivocationProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{2} + return fileDescriptor_f22ec409a72b7b72, []int{3} } func (m *EquivocationProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -293,7 +433,7 @@ func (m *ChangeRewardDenomsProposal) Reset() { *m = ChangeRewardDenomsPr func (m *ChangeRewardDenomsProposal) String() string { return proto.CompactTextString(m) } func (*ChangeRewardDenomsProposal) ProtoMessage() {} func (*ChangeRewardDenomsProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{3} + return fileDescriptor_f22ec409a72b7b72, []int{4} } func (m *ChangeRewardDenomsProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -374,7 +514,7 @@ func (m *GlobalSlashEntry) Reset() { *m = GlobalSlashEntry{} } func (m *GlobalSlashEntry) String() string { return proto.CompactTextString(m) } func (*GlobalSlashEntry) ProtoMessage() {} func (*GlobalSlashEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{4} + return fileDescriptor_f22ec409a72b7b72, []int{5} } func (m *GlobalSlashEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -463,7 +603,7 @@ func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{5} + return fileDescriptor_f22ec409a72b7b72, []int{6} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -565,7 +705,7 @@ func (m *SlashAcks) Reset() { *m = SlashAcks{} } func (m *SlashAcks) String() string { return proto.CompactTextString(m) } func (*SlashAcks) ProtoMessage() {} func (*SlashAcks) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{6} + return fileDescriptor_f22ec409a72b7b72, []int{7} } func (m *SlashAcks) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -612,7 +752,7 @@ func (m *ConsumerAdditionProposals) Reset() { *m = ConsumerAdditionPropo func (m *ConsumerAdditionProposals) String() string { return proto.CompactTextString(m) } func (*ConsumerAdditionProposals) ProtoMessage() {} func (*ConsumerAdditionProposals) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{7} + return fileDescriptor_f22ec409a72b7b72, []int{8} } func (m *ConsumerAdditionProposals) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -659,7 +799,7 @@ func (m *ConsumerRemovalProposals) Reset() { *m = ConsumerRemovalProposa func (m *ConsumerRemovalProposals) String() string { return proto.CompactTextString(m) } func (*ConsumerRemovalProposals) ProtoMessage() {} func (*ConsumerRemovalProposals) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{8} + return fileDescriptor_f22ec409a72b7b72, []int{9} } func (m *ConsumerRemovalProposals) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -704,7 +844,7 @@ func (m *AddressList) Reset() { *m = AddressList{} } func (m *AddressList) String() string { return proto.CompactTextString(m) } func (*AddressList) ProtoMessage() {} func (*AddressList) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{9} + return fileDescriptor_f22ec409a72b7b72, []int{10} } func (m *AddressList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -750,7 +890,7 @@ func (m *ChannelToChain) Reset() { *m = ChannelToChain{} } func (m *ChannelToChain) String() string { return proto.CompactTextString(m) } func (*ChannelToChain) ProtoMessage() {} func (*ChannelToChain) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{10} + return fileDescriptor_f22ec409a72b7b72, []int{11} } func (m *ChannelToChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -804,7 +944,7 @@ func (m *VscUnbondingOps) Reset() { *m = VscUnbondingOps{} } func (m *VscUnbondingOps) String() string { return proto.CompactTextString(m) } func (*VscUnbondingOps) ProtoMessage() {} func (*VscUnbondingOps) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{11} + return fileDescriptor_f22ec409a72b7b72, []int{12} } func (m *VscUnbondingOps) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -859,7 +999,7 @@ func (m *UnbondingOp) Reset() { *m = UnbondingOp{} } func (m *UnbondingOp) String() string { return proto.CompactTextString(m) } func (*UnbondingOp) ProtoMessage() {} func (*UnbondingOp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{12} + return fileDescriptor_f22ec409a72b7b72, []int{13} } func (m *UnbondingOp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -911,7 +1051,7 @@ func (m *InitTimeoutTimestamp) Reset() { *m = InitTimeoutTimestamp{} } func (m *InitTimeoutTimestamp) String() string { return proto.CompactTextString(m) } func (*InitTimeoutTimestamp) ProtoMessage() {} func (*InitTimeoutTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{13} + return fileDescriptor_f22ec409a72b7b72, []int{14} } func (m *InitTimeoutTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -963,7 +1103,7 @@ func (m *VscSendTimestamp) Reset() { *m = VscSendTimestamp{} } func (m *VscSendTimestamp) String() string { return proto.CompactTextString(m) } func (*VscSendTimestamp) ProtoMessage() {} func (*VscSendTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{14} + return fileDescriptor_f22ec409a72b7b72, []int{15} } func (m *VscSendTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1015,7 +1155,7 @@ func (m *ValidatorSetChangePackets) Reset() { *m = ValidatorSetChangePac func (m *ValidatorSetChangePackets) String() string { return proto.CompactTextString(m) } func (*ValidatorSetChangePackets) ProtoMessage() {} func (*ValidatorSetChangePackets) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{15} + return fileDescriptor_f22ec409a72b7b72, []int{16} } func (m *ValidatorSetChangePackets) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1061,7 +1201,7 @@ func (m *MaturedUnbondingOps) Reset() { *m = MaturedUnbondingOps{} } func (m *MaturedUnbondingOps) String() string { return proto.CompactTextString(m) } func (*MaturedUnbondingOps) ProtoMessage() {} func (*MaturedUnbondingOps) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{16} + return fileDescriptor_f22ec409a72b7b72, []int{17} } func (m *MaturedUnbondingOps) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1107,7 +1247,7 @@ func (m *ExportedVscSendTimestamp) Reset() { *m = ExportedVscSendTimesta func (m *ExportedVscSendTimestamp) String() string { return proto.CompactTextString(m) } func (*ExportedVscSendTimestamp) ProtoMessage() {} func (*ExportedVscSendTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{17} + return fileDescriptor_f22ec409a72b7b72, []int{18} } func (m *ExportedVscSendTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1160,7 +1300,7 @@ func (m *KeyAssignmentReplacement) Reset() { *m = KeyAssignmentReplaceme func (m *KeyAssignmentReplacement) String() string { return proto.CompactTextString(m) } func (*KeyAssignmentReplacement) ProtoMessage() {} func (*KeyAssignmentReplacement) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{18} + return fileDescriptor_f22ec409a72b7b72, []int{19} } func (m *KeyAssignmentReplacement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1223,7 +1363,7 @@ func (m *ValidatorConsumerPubKey) Reset() { *m = ValidatorConsumerPubKey func (m *ValidatorConsumerPubKey) String() string { return proto.CompactTextString(m) } func (*ValidatorConsumerPubKey) ProtoMessage() {} func (*ValidatorConsumerPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{19} + return fileDescriptor_f22ec409a72b7b72, []int{20} } func (m *ValidatorConsumerPubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1286,7 +1426,7 @@ func (m *ValidatorByConsumerAddr) Reset() { *m = ValidatorByConsumerAddr func (m *ValidatorByConsumerAddr) String() string { return proto.CompactTextString(m) } func (*ValidatorByConsumerAddr) ProtoMessage() {} func (*ValidatorByConsumerAddr) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{20} + return fileDescriptor_f22ec409a72b7b72, []int{21} } func (m *ValidatorByConsumerAddr) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1348,7 +1488,7 @@ func (m *ConsumerAddrsToPrune) Reset() { *m = ConsumerAddrsToPrune{} } func (m *ConsumerAddrsToPrune) String() string { return proto.CompactTextString(m) } func (*ConsumerAddrsToPrune) ProtoMessage() {} func (*ConsumerAddrsToPrune) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{21} + return fileDescriptor_f22ec409a72b7b72, []int{22} } func (m *ConsumerAddrsToPrune) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1413,7 +1553,7 @@ func (m *ConsumerValidator) Reset() { *m = ConsumerValidator{} } func (m *ConsumerValidator) String() string { return proto.CompactTextString(m) } func (*ConsumerValidator) ProtoMessage() {} func (*ConsumerValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{22} + return fileDescriptor_f22ec409a72b7b72, []int{23} } func (m *ConsumerValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1463,9 +1603,57 @@ func (m *ConsumerValidator) GetConsumerPublicKey() *crypto.PublicKey { return nil } +// ConsumerRewardsAllocation stores the rewards allocated by a consumer chain +// to the consumer rewards pool. It is used to allocate the tokens to the consumer +// opted-in validators and the community pool during BeginBlock. +type ConsumerRewardsAllocation struct { + Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"` +} + +func (m *ConsumerRewardsAllocation) Reset() { *m = ConsumerRewardsAllocation{} } +func (m *ConsumerRewardsAllocation) String() string { return proto.CompactTextString(m) } +func (*ConsumerRewardsAllocation) ProtoMessage() {} +func (*ConsumerRewardsAllocation) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{24} +} +func (m *ConsumerRewardsAllocation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerRewardsAllocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerRewardsAllocation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerRewardsAllocation) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerRewardsAllocation.Merge(m, src) +} +func (m *ConsumerRewardsAllocation) XXX_Size() int { + return m.Size() +} +func (m *ConsumerRewardsAllocation) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerRewardsAllocation.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerRewardsAllocation proto.InternalMessageInfo + +func (m *ConsumerRewardsAllocation) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Rewards + } + return nil +} + func init() { proto.RegisterType((*ConsumerAdditionProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposal") proto.RegisterType((*ConsumerRemovalProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposal") + proto.RegisterType((*ConsumerModificationProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerModificationProposal") proto.RegisterType((*EquivocationProposal)(nil), "interchain_security.ccv.provider.v1.EquivocationProposal") proto.RegisterType((*ChangeRewardDenomsProposal)(nil), "interchain_security.ccv.provider.v1.ChangeRewardDenomsProposal") proto.RegisterType((*GlobalSlashEntry)(nil), "interchain_security.ccv.provider.v1.GlobalSlashEntry") @@ -1487,6 +1675,7 @@ func init() { proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") proto.RegisterType((*ConsumerValidator)(nil), "interchain_security.ccv.provider.v1.ConsumerValidator") + proto.RegisterType((*ConsumerRewardsAllocation)(nil), "interchain_security.ccv.provider.v1.ConsumerRewardsAllocation") } func init() { @@ -1494,119 +1683,132 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1790 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0x1b, 0xc7, - 0x15, 0xd7, 0x92, 0x94, 0x2c, 0x3e, 0x4a, 0x94, 0xb4, 0x52, 0x62, 0x4a, 0x55, 0x29, 0x79, 0xd3, - 0xb8, 0x2a, 0x52, 0x2f, 0x2b, 0x05, 0x01, 0x02, 0xa1, 0x41, 0x20, 0x51, 0x4e, 0x2c, 0x2b, 0x89, - 0x95, 0x95, 0x2a, 0xa3, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xb3, - 0xeb, 0xf0, 0xd2, 0x73, 0x8f, 0xe9, 0x2d, 0xe8, 0xa5, 0x69, 0x81, 0x7e, 0x83, 0x7e, 0x82, 0x9e, - 0x82, 0x5e, 0x9a, 0x63, 0x4f, 0x69, 0x61, 0x1f, 0xfb, 0x19, 0x0a, 0x14, 0x33, 0xfb, 0x97, 0x94, - 0x64, 0xd3, 0x48, 0x7b, 0xdb, 0x79, 0xf3, 0xde, 0xef, 0xfd, 0x7f, 0x6f, 0x48, 0xd8, 0xa3, 0x81, - 0x24, 0x1c, 0x0f, 0x10, 0x0d, 0x5c, 0x41, 0x70, 0xc4, 0xa9, 0x1c, 0x75, 0x30, 0x8e, 0x3b, 0x21, - 0x67, 0x31, 0xf5, 0x08, 0xef, 0xc4, 0xbb, 0xf9, 0xb7, 0x1d, 0x72, 0x26, 0x99, 0xf9, 0xd6, 0x35, - 0x32, 0x36, 0xc6, 0xb1, 0x9d, 0xf3, 0xc5, 0xbb, 0x1b, 0x6f, 0xdf, 0x04, 0x1c, 0xef, 0x76, 0x9e, - 0x51, 0x4e, 0x12, 0xac, 0x8d, 0xb5, 0x3e, 0xeb, 0x33, 0xfd, 0xd9, 0x51, 0x5f, 0x29, 0x75, 0xab, - 0xcf, 0x58, 0xdf, 0x27, 0x1d, 0x7d, 0xea, 0x45, 0x4f, 0x3a, 0x92, 0x0e, 0x89, 0x90, 0x68, 0x18, - 0xa6, 0x0c, 0xed, 0x49, 0x06, 0x2f, 0xe2, 0x48, 0x52, 0x16, 0x64, 0x00, 0xb4, 0x87, 0x3b, 0x98, - 0x71, 0xd2, 0xc1, 0x3e, 0x25, 0x81, 0x54, 0x5a, 0x93, 0xaf, 0x94, 0xa1, 0xa3, 0x18, 0x7c, 0xda, - 0x1f, 0xc8, 0x84, 0x2c, 0x3a, 0x92, 0x04, 0x1e, 0xe1, 0x43, 0x9a, 0x30, 0x17, 0xa7, 0x54, 0x60, - 0xb3, 0x74, 0x8f, 0xf9, 0x28, 0x94, 0xac, 0x73, 0x49, 0x46, 0x22, 0xbd, 0xbd, 0x8b, 0x99, 0x18, - 0x32, 0xd1, 0x21, 0xca, 0xff, 0x00, 0x93, 0x4e, 0xbc, 0xdb, 0x23, 0x12, 0xed, 0xe6, 0x84, 0xcc, - 0xee, 0x94, 0xaf, 0x87, 0x44, 0xc1, 0x83, 0x19, 0xcd, 0xec, 0x5e, 0x4f, 0xee, 0xdd, 0x24, 0x22, - 0xc9, 0x21, 0xb9, 0xb2, 0xfe, 0x33, 0x07, 0xad, 0x2e, 0x0b, 0x44, 0x34, 0x24, 0xfc, 0xc0, 0xf3, - 0xa8, 0xf2, 0xf6, 0x94, 0xb3, 0x90, 0x09, 0xe4, 0x9b, 0x6b, 0x30, 0x2b, 0xa9, 0xf4, 0x49, 0xcb, - 0xd8, 0x36, 0x76, 0xea, 0x4e, 0x72, 0x30, 0xb7, 0xa1, 0xe1, 0x11, 0x81, 0x39, 0x0d, 0x15, 0x73, - 0xab, 0xa2, 0xef, 0xca, 0x24, 0x73, 0x1d, 0xe6, 0x93, 0x14, 0x51, 0xaf, 0x55, 0xd5, 0xd7, 0xb7, - 0xf4, 0xf9, 0xd8, 0x33, 0x3f, 0x86, 0x26, 0x0d, 0xa8, 0xa4, 0xc8, 0x77, 0x07, 0x44, 0x05, 0xaa, - 0x55, 0xdb, 0x36, 0x76, 0x1a, 0x7b, 0x1b, 0x36, 0xed, 0x61, 0x5b, 0xc5, 0xd6, 0x4e, 0x23, 0x1a, - 0xef, 0xda, 0x0f, 0x34, 0xc7, 0x61, 0xed, 0x9b, 0xef, 0xb6, 0x66, 0x9c, 0xc5, 0x54, 0x2e, 0x21, - 0x9a, 0x77, 0x60, 0xa1, 0x4f, 0x02, 0x22, 0xa8, 0x70, 0x07, 0x48, 0x0c, 0x5a, 0xb3, 0xdb, 0xc6, - 0xce, 0x82, 0xd3, 0x48, 0x69, 0x0f, 0x90, 0x18, 0x98, 0x5b, 0xd0, 0xe8, 0xd1, 0x00, 0xf1, 0x51, - 0xc2, 0x31, 0xa7, 0x39, 0x20, 0x21, 0x69, 0x86, 0x2e, 0x80, 0x08, 0xd1, 0xb3, 0xc0, 0x55, 0x85, - 0xd0, 0xba, 0x95, 0x1a, 0x92, 0x14, 0x81, 0x9d, 0x15, 0x81, 0x7d, 0x9e, 0x55, 0xc9, 0xe1, 0xbc, - 0x32, 0xe4, 0xcb, 0x7f, 0x6e, 0x19, 0x4e, 0x5d, 0xcb, 0xa9, 0x1b, 0xf3, 0x33, 0x58, 0x8e, 0x82, - 0x1e, 0x0b, 0x3c, 0x1a, 0xf4, 0xdd, 0x90, 0x70, 0xca, 0xbc, 0xd6, 0xbc, 0x86, 0x5a, 0xbf, 0x02, - 0x75, 0x94, 0xd6, 0x53, 0x82, 0xf4, 0x95, 0x42, 0x5a, 0xca, 0x85, 0x4f, 0xb5, 0xac, 0xf9, 0x39, - 0x98, 0x18, 0xc7, 0xda, 0x24, 0x16, 0xc9, 0x0c, 0xb1, 0x3e, 0x3d, 0xe2, 0x32, 0xc6, 0xf1, 0x79, - 0x22, 0x9d, 0x42, 0xfe, 0x1a, 0x6e, 0x4b, 0x8e, 0x02, 0xf1, 0x84, 0xf0, 0x49, 0x5c, 0x98, 0x1e, - 0xf7, 0x8d, 0x0c, 0x63, 0x1c, 0xfc, 0x01, 0x6c, 0xe3, 0xb4, 0x80, 0x5c, 0x4e, 0x3c, 0x2a, 0x24, - 0xa7, 0xbd, 0x48, 0xc9, 0xba, 0x4f, 0x38, 0xc2, 0xba, 0x46, 0x1a, 0xba, 0x08, 0xda, 0x19, 0x9f, - 0x33, 0xc6, 0xf6, 0x51, 0xca, 0x65, 0x3e, 0x82, 0x1f, 0xf5, 0x7c, 0x86, 0x2f, 0x85, 0x32, 0xce, - 0x1d, 0x43, 0xd2, 0xaa, 0x87, 0x54, 0x08, 0x85, 0xb6, 0xb0, 0x6d, 0xec, 0x54, 0x9d, 0x3b, 0x09, - 0xef, 0x29, 0xe1, 0x47, 0x25, 0xce, 0xf3, 0x12, 0xa3, 0x79, 0x0f, 0xcc, 0x01, 0x15, 0x92, 0x71, - 0x8a, 0x91, 0xef, 0x92, 0x40, 0x72, 0x4a, 0x44, 0x6b, 0x51, 0x8b, 0xaf, 0x14, 0x37, 0xf7, 0x93, - 0x0b, 0xf3, 0x21, 0xdc, 0xb9, 0x51, 0xa9, 0x8b, 0x07, 0x28, 0x08, 0x88, 0xdf, 0x6a, 0x6a, 0x57, - 0xb6, 0xbc, 0x1b, 0x74, 0x76, 0x13, 0xb6, 0xfd, 0xbb, 0xbf, 0xfd, 0x7a, 0x6b, 0xe6, 0xab, 0xaf, - 0xb7, 0x66, 0xfe, 0xf6, 0x97, 0x7b, 0x1b, 0x69, 0xc7, 0xf5, 0x59, 0x6c, 0xa7, 0xdd, 0x69, 0x77, - 0x59, 0x20, 0x49, 0x20, 0xad, 0xbf, 0x1b, 0x70, 0xbb, 0x9b, 0x87, 0x65, 0xc8, 0x62, 0xe4, 0xff, - 0x3f, 0xdb, 0xef, 0x00, 0xea, 0x42, 0xb2, 0x30, 0x29, 0xf8, 0xda, 0x6b, 0x14, 0xfc, 0xbc, 0x12, - 0x53, 0x17, 0xfb, 0xed, 0x57, 0x78, 0xf4, 0x07, 0x03, 0xd6, 0xee, 0x3f, 0x8d, 0x68, 0xcc, 0x30, - 0xfa, 0x9f, 0x4c, 0x93, 0x13, 0x58, 0x24, 0x25, 0x3c, 0xd1, 0xaa, 0x6e, 0x57, 0x77, 0x1a, 0x7b, - 0x6f, 0xdb, 0xa9, 0x11, 0xf9, 0x30, 0xcc, 0x2c, 0x29, 0x6b, 0x77, 0xc6, 0x65, 0xf7, 0x2b, 0x2d, - 0xc3, 0xfa, 0xab, 0x01, 0x1b, 0x2a, 0x4f, 0x7d, 0xe2, 0x90, 0x67, 0x88, 0x7b, 0x47, 0x24, 0x60, - 0x43, 0xf1, 0xbd, 0xed, 0xb4, 0x60, 0xd1, 0xd3, 0x48, 0xae, 0x64, 0x2e, 0xf2, 0x3c, 0x6d, 0xa7, - 0xe6, 0x51, 0xc4, 0x73, 0x76, 0xe0, 0x79, 0xe6, 0x0e, 0x2c, 0x17, 0x3c, 0x5c, 0xe5, 0x5b, 0xa5, - 0x41, 0xb1, 0x35, 0x33, 0x36, 0x5d, 0x05, 0xaf, 0x0e, 0xf3, 0xbf, 0x0d, 0x58, 0xfe, 0xd8, 0x67, - 0x3d, 0xe4, 0x9f, 0xf9, 0x48, 0x0c, 0x54, 0x0d, 0x8f, 0x54, 0x7a, 0x39, 0x49, 0x87, 0x87, 0x36, - 0x7f, 0xea, 0xf4, 0x2a, 0x31, 0x3d, 0xce, 0x3e, 0x84, 0x95, 0xbc, 0x9d, 0xf3, 0x2a, 0xd2, 0xde, - 0x1e, 0xae, 0x3e, 0xff, 0x6e, 0x6b, 0x29, 0x2b, 0xd6, 0xae, 0xae, 0xa8, 0x23, 0x67, 0x09, 0x8f, - 0x11, 0x3c, 0xb3, 0x0d, 0x0d, 0xda, 0xc3, 0xae, 0x20, 0x4f, 0xdd, 0x20, 0x1a, 0xea, 0x02, 0xac, - 0x39, 0x75, 0xda, 0xc3, 0x67, 0xe4, 0xe9, 0x67, 0xd1, 0xd0, 0x7c, 0x17, 0xde, 0xcc, 0x36, 0xba, - 0x1b, 0x23, 0xdf, 0x55, 0xf2, 0x2a, 0x5c, 0x5c, 0xd7, 0xe3, 0x82, 0xb3, 0x9a, 0xdd, 0x5e, 0x20, - 0x5f, 0x29, 0x3b, 0xf0, 0x3c, 0x6e, 0xbd, 0x98, 0x85, 0xb9, 0x53, 0xc4, 0xd1, 0x50, 0x98, 0xe7, - 0xb0, 0x24, 0xc9, 0x30, 0xf4, 0x91, 0x24, 0x6e, 0xb2, 0x2a, 0x52, 0x4f, 0xdf, 0xd1, 0x2b, 0xa4, - 0xbc, 0x7d, 0xed, 0xd2, 0xbe, 0x8d, 0x77, 0xed, 0xae, 0xa6, 0x9e, 0x49, 0x24, 0x89, 0xd3, 0xcc, - 0x30, 0x12, 0xa2, 0xf9, 0x3e, 0xb4, 0x24, 0x8f, 0x84, 0x2c, 0x86, 0x78, 0x31, 0xbd, 0x92, 0x5c, - 0xbf, 0x99, 0xdd, 0x27, 0x73, 0x2f, 0x9f, 0x5a, 0xd7, 0xcf, 0xeb, 0xea, 0xf7, 0x99, 0xd7, 0x67, - 0xb0, 0xaa, 0x96, 0xdd, 0x24, 0x66, 0x6d, 0x7a, 0xcc, 0x15, 0x25, 0x3f, 0x0e, 0xfa, 0x39, 0x98, - 0xb1, 0xc0, 0x93, 0x98, 0xb3, 0xaf, 0x61, 0x67, 0x2c, 0xf0, 0x38, 0xa4, 0x07, 0x9b, 0x42, 0x15, - 0x9f, 0x3b, 0x24, 0x52, 0x4f, 0xff, 0xd0, 0x27, 0x01, 0x15, 0x83, 0x0c, 0x7c, 0x6e, 0x7a, 0xf0, - 0x75, 0x0d, 0xf4, 0xa9, 0xc2, 0x71, 0x32, 0x98, 0x54, 0x4b, 0x17, 0xda, 0xd7, 0x6b, 0xc9, 0x13, - 0x74, 0x4b, 0x27, 0xe8, 0x07, 0xd7, 0x40, 0xe4, 0x59, 0x12, 0x70, 0xb7, 0xb4, 0xa5, 0x54, 0xd7, - 0xbb, 0xba, 0xe1, 0x5c, 0x4e, 0xfa, 0x6a, 0x94, 0xa3, 0x64, 0x61, 0x11, 0x92, 0x6f, 0xda, 0xb4, - 0xf7, 0xd4, 0x9b, 0xaa, 0xd4, 0x7c, 0x34, 0x48, 0x9f, 0x23, 0x56, 0xb1, 0xcc, 0xf2, 0x19, 0xe2, - 0x94, 0xb0, 0x3e, 0x22, 0x44, 0x75, 0x7b, 0x69, 0xa1, 0x91, 0x90, 0xe1, 0x81, 0x5e, 0xb8, 0x55, - 0xa7, 0x99, 0x2f, 0xaf, 0xfb, 0x8a, 0xfa, 0xb0, 0x36, 0x3f, 0xbf, 0x5c, 0xb7, 0x7e, 0x02, 0x75, - 0xdd, 0xcc, 0x07, 0xf8, 0x52, 0x98, 0x9b, 0x50, 0x57, 0x5d, 0x41, 0x84, 0x20, 0xa2, 0x65, 0xe8, - 0x19, 0x51, 0x10, 0x2c, 0x09, 0xeb, 0x37, 0x3d, 0xdb, 0x84, 0xf9, 0x18, 0x6e, 0x85, 0x44, 0xbf, - 0x29, 0xb4, 0x60, 0x63, 0xef, 0x03, 0x7b, 0x8a, 0xc7, 0xb5, 0x7d, 0x13, 0xa0, 0x93, 0xa1, 0x59, - 0xbc, 0x78, 0x2c, 0x4e, 0x2c, 0x2b, 0x61, 0x5e, 0x4c, 0x2a, 0xfd, 0xf9, 0x6b, 0x29, 0x9d, 0xc0, - 0x2b, 0x74, 0xbe, 0x03, 0x8d, 0x83, 0xc4, 0xed, 0x4f, 0xa8, 0x90, 0x57, 0xc3, 0xb2, 0x50, 0x0e, - 0xcb, 0x43, 0x68, 0xa6, 0x1b, 0xf8, 0x9c, 0xe9, 0x81, 0x64, 0xfe, 0x10, 0x20, 0x5d, 0xdd, 0x6a, - 0x90, 0x25, 0x23, 0xbd, 0x9e, 0x52, 0x8e, 0xbd, 0xb1, 0x5d, 0x59, 0x19, 0xdb, 0x95, 0x96, 0x03, - 0x4b, 0x17, 0x02, 0xff, 0x22, 0x7b, 0x9e, 0x3d, 0x0a, 0x85, 0xf9, 0x06, 0xcc, 0xa9, 0x1e, 0x4a, - 0x81, 0x6a, 0xce, 0x6c, 0x2c, 0xf0, 0xb1, 0x9e, 0xea, 0xc5, 0x13, 0x90, 0x85, 0x2e, 0xf5, 0x44, - 0xab, 0xb2, 0x5d, 0xdd, 0xa9, 0x39, 0xcd, 0xa8, 0x10, 0x3f, 0xf6, 0x84, 0xf5, 0x4b, 0x68, 0x94, - 0x00, 0xcd, 0x26, 0x54, 0x72, 0xac, 0x0a, 0xf5, 0xcc, 0x7d, 0x58, 0x2f, 0x80, 0xc6, 0xc7, 0x70, - 0x82, 0x58, 0x77, 0x6e, 0xe7, 0x0c, 0x63, 0x93, 0x58, 0x58, 0x8f, 0x60, 0xed, 0xb8, 0x68, 0xfa, - 0x7c, 0xc8, 0x8f, 0x79, 0x68, 0x8c, 0xbf, 0x06, 0x36, 0xa1, 0x9e, 0xff, 0x04, 0xd2, 0xde, 0xd7, - 0x9c, 0x82, 0x60, 0x0d, 0x61, 0xf9, 0x42, 0xe0, 0x33, 0x12, 0x78, 0x05, 0xd8, 0x0d, 0x01, 0x38, - 0x9c, 0x04, 0x9a, 0xfa, 0x1d, 0x5d, 0xa8, 0x63, 0xb0, 0x7e, 0x81, 0x7c, 0xea, 0x21, 0xc9, 0xf8, - 0x19, 0x91, 0xc9, 0x82, 0x3e, 0x45, 0xf8, 0x92, 0x48, 0x61, 0x3a, 0x50, 0xf3, 0xa9, 0x90, 0x69, - 0x65, 0xbd, 0x7f, 0x63, 0x65, 0xc5, 0xbb, 0xf6, 0x4d, 0x20, 0x47, 0x48, 0xa2, 0xb4, 0x77, 0x35, - 0x96, 0xf5, 0x63, 0x58, 0xfd, 0x14, 0xc9, 0x88, 0x13, 0x6f, 0x2c, 0xc7, 0xcb, 0x50, 0x55, 0xf9, - 0x33, 0x74, 0xfe, 0xd4, 0xa7, 0xf5, 0x27, 0x03, 0x5a, 0xf7, 0xbf, 0x08, 0x19, 0x97, 0xc4, 0xbb, - 0x12, 0x91, 0x97, 0x84, 0xf7, 0x12, 0x56, 0x55, 0xb0, 0x04, 0x09, 0x3c, 0x37, 0xf7, 0x33, 0xc9, - 0x63, 0x63, 0xef, 0xbd, 0xa9, 0xba, 0x63, 0x52, 0x5d, 0xea, 0xc0, 0x4a, 0x3c, 0x41, 0x17, 0xd6, - 0xef, 0x0c, 0x68, 0x9d, 0x90, 0xd1, 0x81, 0x10, 0xb4, 0x1f, 0x0c, 0x49, 0x20, 0xd5, 0x0c, 0x44, - 0x98, 0xa8, 0x4f, 0xf3, 0x2d, 0x58, 0xcc, 0x77, 0xae, 0x5e, 0xb5, 0x86, 0x5e, 0xb5, 0x0b, 0x19, - 0x51, 0x35, 0x98, 0xb9, 0x0f, 0x10, 0x72, 0x12, 0xbb, 0xd8, 0xbd, 0x24, 0xa3, 0x34, 0x8b, 0x9b, - 0xe5, 0x15, 0x9a, 0xfc, 0x40, 0xb5, 0x4f, 0xa3, 0x9e, 0x4f, 0xf1, 0x09, 0x19, 0x39, 0xf3, 0x8a, - 0xbf, 0x7b, 0x42, 0x46, 0xea, 0xcd, 0x14, 0xb2, 0x67, 0x84, 0xeb, 0xbd, 0x57, 0x75, 0x92, 0x83, - 0xf5, 0x7b, 0x03, 0x6e, 0xe7, 0xe9, 0xc8, 0xca, 0xf5, 0x34, 0xea, 0x29, 0x89, 0x97, 0xc4, 0xed, - 0x8a, 0xb5, 0x95, 0x6b, 0xac, 0xfd, 0x10, 0x16, 0xf2, 0x06, 0x51, 0xf6, 0x56, 0xa7, 0xb0, 0xb7, - 0x91, 0x49, 0x9c, 0x90, 0x91, 0xf5, 0x9b, 0x92, 0x6d, 0x87, 0xa3, 0xd2, 0xec, 0xe3, 0xaf, 0xb0, - 0x2d, 0x57, 0x5b, 0xb6, 0x0d, 0x97, 0xe5, 0xaf, 0x38, 0x50, 0xbd, 0xea, 0x80, 0xf5, 0x47, 0x03, - 0xd6, 0xca, 0x5a, 0xc5, 0x39, 0x3b, 0xe5, 0x51, 0x40, 0x5e, 0xa6, 0xbd, 0x68, 0xbf, 0x4a, 0xb9, - 0xfd, 0x1e, 0x43, 0x73, 0xcc, 0x28, 0x91, 0x46, 0xe3, 0x67, 0x53, 0xd5, 0x58, 0x69, 0xba, 0x3a, - 0x8b, 0x65, 0x3f, 0x84, 0xf5, 0x67, 0x03, 0x56, 0x32, 0x1b, 0xf3, 0x60, 0x99, 0x3f, 0x05, 0x33, - 0x77, 0xaf, 0x78, 0xbd, 0x25, 0x25, 0xb5, 0x9c, 0xdd, 0x64, 0x4f, 0xb7, 0xa2, 0x34, 0x2a, 0xa5, - 0xd2, 0x30, 0x3f, 0x81, 0xd5, 0xdc, 0xe4, 0x50, 0x27, 0x68, 0xea, 0x2c, 0xe6, 0xef, 0xd3, 0x9c, - 0x74, 0xf8, 0xf8, 0x9b, 0xe7, 0x6d, 0xe3, 0xdb, 0xe7, 0x6d, 0xe3, 0x5f, 0xcf, 0xdb, 0xc6, 0x97, - 0x2f, 0xda, 0x33, 0xdf, 0xbe, 0x68, 0xcf, 0xfc, 0xe3, 0x45, 0x7b, 0xe6, 0x57, 0x1f, 0xf4, 0xa9, - 0x1c, 0x44, 0x3d, 0x1b, 0xb3, 0x61, 0xfa, 0xc7, 0x47, 0xa7, 0x88, 0xc9, 0xbd, 0xfc, 0x2f, 0xa4, - 0xf8, 0xbd, 0xce, 0x17, 0xe3, 0x7f, 0x50, 0xc9, 0x51, 0x48, 0x44, 0x6f, 0x4e, 0x4f, 0xaf, 0x77, - 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xad, 0xbf, 0x18, 0xd1, 0x12, 0x00, 0x00, + // 1988 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcb, 0x6f, 0x1b, 0xc7, + 0x19, 0xd7, 0x92, 0x94, 0x44, 0x0e, 0xf5, 0x1c, 0x29, 0xf1, 0x4a, 0x55, 0x29, 0x7a, 0xd3, 0xb8, + 0x6a, 0x5c, 0x2f, 0x23, 0x07, 0x01, 0x0c, 0xa1, 0x41, 0x20, 0x51, 0x4e, 0x2c, 0x2b, 0xb6, 0x95, + 0x95, 0x2a, 0xa3, 0xed, 0x61, 0x31, 0x9c, 0x1d, 0x93, 0x03, 0x2d, 0x77, 0xd6, 0x33, 0xc3, 0x55, + 0x78, 0xe9, 0xb9, 0x97, 0x02, 0xe9, 0x2d, 0xe8, 0xa1, 0x4d, 0x0b, 0x14, 0x28, 0x72, 0xea, 0xa1, + 0x7f, 0x41, 0x4f, 0x41, 0x2f, 0xcd, 0xb1, 0xa7, 0xa4, 0xb0, 0x0f, 0x3d, 0xf4, 0x9f, 0x28, 0x66, + 0xf6, 0x49, 0x4a, 0xb2, 0x69, 0x24, 0xb9, 0x48, 0xbb, 0xdf, 0xe3, 0xf7, 0x7d, 0x33, 0xdf, 0x93, + 0x0b, 0x6e, 0xd3, 0x40, 0x12, 0x8e, 0x7b, 0x88, 0x06, 0xae, 0x20, 0x78, 0xc0, 0xa9, 0x1c, 0xb6, + 0x30, 0x8e, 0x5a, 0x21, 0x67, 0x11, 0xf5, 0x08, 0x6f, 0x45, 0xdb, 0xd9, 0xb3, 0x1d, 0x72, 0x26, + 0x19, 0x7c, 0xe3, 0x12, 0x1d, 0x1b, 0xe3, 0xc8, 0xce, 0xe4, 0xa2, 0xed, 0xf5, 0x37, 0xaf, 0x02, + 0x8e, 0xb6, 0x5b, 0xe7, 0x94, 0x93, 0x18, 0x6b, 0x7d, 0xb5, 0xcb, 0xba, 0x4c, 0x3f, 0xb6, 0xd4, + 0x53, 0x42, 0xdd, 0xec, 0x32, 0xd6, 0xf5, 0x49, 0x4b, 0xbf, 0x75, 0x06, 0x4f, 0x5a, 0x92, 0xf6, + 0x89, 0x90, 0xa8, 0x1f, 0x26, 0x02, 0x8d, 0x71, 0x01, 0x6f, 0xc0, 0x91, 0xa4, 0x2c, 0x48, 0x01, + 0x68, 0x07, 0xb7, 0x30, 0xe3, 0xa4, 0x85, 0x7d, 0x4a, 0x02, 0xa9, 0xac, 0xc6, 0x4f, 0x89, 0x40, + 0x4b, 0x09, 0xf8, 0xb4, 0xdb, 0x93, 0x31, 0x59, 0xb4, 0x24, 0x09, 0x3c, 0xc2, 0xfb, 0x34, 0x16, + 0xce, 0xdf, 0x12, 0x85, 0x8d, 0x02, 0x1f, 0xf3, 0x61, 0x28, 0x59, 0xeb, 0x8c, 0x0c, 0x45, 0xc2, + 0xbd, 0x81, 0x99, 0xe8, 0x33, 0xd1, 0x22, 0xea, 0xfc, 0x01, 0x26, 0xad, 0x68, 0xbb, 0x43, 0x24, + 0xda, 0xce, 0x08, 0xa9, 0xdf, 0x89, 0x5c, 0x07, 0x89, 0x5c, 0x06, 0x33, 0x9a, 0xfa, 0xbd, 0x16, + 0xf3, 0xdd, 0xf8, 0x46, 0xe2, 0x97, 0x84, 0xb5, 0x8c, 0xfa, 0x34, 0x60, 0x2d, 0xfd, 0x37, 0x26, + 0x59, 0x5f, 0x54, 0x81, 0xd9, 0x66, 0x81, 0x18, 0xf4, 0x09, 0xdf, 0xf5, 0x3c, 0xaa, 0x2e, 0xe0, + 0x88, 0xb3, 0x90, 0x09, 0xe4, 0xc3, 0x55, 0x30, 0x2d, 0xa9, 0xf4, 0x89, 0x69, 0x34, 0x8d, 0xad, + 0x9a, 0x13, 0xbf, 0xc0, 0x26, 0xa8, 0x7b, 0x44, 0x60, 0x4e, 0x43, 0x25, 0x6c, 0x96, 0x34, 0xaf, + 0x48, 0x82, 0x6b, 0xa0, 0x1a, 0x47, 0x8d, 0x7a, 0x66, 0x59, 0xb3, 0x67, 0xf5, 0xfb, 0x81, 0x07, + 0x3f, 0x04, 0x0b, 0x34, 0xa0, 0x92, 0x22, 0xdf, 0xed, 0x11, 0x75, 0x77, 0x66, 0xa5, 0x69, 0x6c, + 0xd5, 0x6f, 0xaf, 0xdb, 0xb4, 0x83, 0x6d, 0x75, 0xdd, 0x76, 0x72, 0xc9, 0xd1, 0xb6, 0x7d, 0x4f, + 0x4b, 0xec, 0x55, 0xbe, 0xfc, 0x7a, 0x73, 0xca, 0x99, 0x4f, 0xf4, 0x62, 0x22, 0xbc, 0x0e, 0xe6, + 0xba, 0x24, 0x20, 0x82, 0x0a, 0xb7, 0x87, 0x44, 0xcf, 0x9c, 0x6e, 0x1a, 0x5b, 0x73, 0x4e, 0x3d, + 0xa1, 0xdd, 0x43, 0xa2, 0x07, 0x37, 0x41, 0xbd, 0x43, 0x03, 0xc4, 0x87, 0xb1, 0xc4, 0x8c, 0x96, + 0x00, 0x31, 0x49, 0x0b, 0xb4, 0x01, 0x10, 0x21, 0x3a, 0x0f, 0x5c, 0x95, 0x1b, 0xe6, 0x6c, 0xe2, + 0x48, 0x9c, 0x17, 0x76, 0x9a, 0x17, 0xf6, 0x49, 0x9a, 0x38, 0x7b, 0x55, 0xe5, 0xc8, 0xa7, 0xdf, + 0x6c, 0x1a, 0x4e, 0x4d, 0xeb, 0x29, 0x0e, 0x7c, 0x08, 0x96, 0x06, 0x41, 0x87, 0x05, 0x1e, 0x0d, + 0xba, 0x6e, 0x48, 0x38, 0x65, 0x9e, 0x59, 0xd5, 0x50, 0x6b, 0x17, 0xa0, 0xf6, 0x93, 0x14, 0x8b, + 0x91, 0x3e, 0x53, 0x48, 0x8b, 0x99, 0xf2, 0x91, 0xd6, 0x85, 0x1f, 0x03, 0x88, 0x71, 0xa4, 0x5d, + 0x62, 0x03, 0x99, 0x22, 0xd6, 0x26, 0x47, 0x5c, 0xc2, 0x38, 0x3a, 0x89, 0xb5, 0x13, 0xc8, 0x5f, + 0x81, 0x6b, 0x92, 0xa3, 0x40, 0x3c, 0x21, 0x7c, 0x1c, 0x17, 0x4c, 0x8e, 0xfb, 0x5a, 0x8a, 0x31, + 0x0a, 0x7e, 0x0f, 0x34, 0x71, 0x92, 0x40, 0x2e, 0x27, 0x1e, 0x15, 0x92, 0xd3, 0xce, 0x40, 0xe9, + 0xba, 0x4f, 0x38, 0xc2, 0x3a, 0x47, 0xea, 0x3a, 0x09, 0x1a, 0xa9, 0x9c, 0x33, 0x22, 0xf6, 0x41, + 0x22, 0x05, 0x1f, 0x81, 0x1f, 0x75, 0x7c, 0x86, 0xcf, 0x84, 0x72, 0xce, 0x1d, 0x41, 0xd2, 0xa6, + 0xfb, 0x54, 0x08, 0x85, 0x36, 0xd7, 0x34, 0xb6, 0xca, 0xce, 0xf5, 0x58, 0xf6, 0x88, 0xf0, 0xfd, + 0x82, 0xe4, 0x49, 0x41, 0x10, 0xde, 0x02, 0xb0, 0x47, 0x85, 0x64, 0x9c, 0x62, 0xe4, 0xbb, 0x24, + 0x90, 0x9c, 0x12, 0x61, 0xce, 0x6b, 0xf5, 0xe5, 0x9c, 0x73, 0x37, 0x66, 0xc0, 0xfb, 0xe0, 0xfa, + 0x95, 0x46, 0x5d, 0xdc, 0x43, 0x41, 0x40, 0x7c, 0x73, 0x41, 0x1f, 0x65, 0xd3, 0xbb, 0xc2, 0x66, + 0x3b, 0x16, 0x83, 0x2b, 0x60, 0x5a, 0xb2, 0xd0, 0x7d, 0x68, 0x2e, 0x36, 0x8d, 0xad, 0x79, 0xa7, + 0x22, 0x59, 0xf8, 0x10, 0xbe, 0x0d, 0x56, 0x23, 0xe4, 0x53, 0x0f, 0x49, 0xc6, 0x85, 0x1b, 0xb2, + 0x73, 0xc2, 0x5d, 0x8c, 0x42, 0x73, 0x49, 0xcb, 0xc0, 0x9c, 0x77, 0xa4, 0x58, 0x6d, 0x14, 0xc2, + 0xb7, 0xc0, 0x72, 0x46, 0x75, 0x05, 0x91, 0x5a, 0x7c, 0x59, 0x8b, 0x2f, 0x66, 0x8c, 0x63, 0x22, + 0x95, 0xec, 0x06, 0xa8, 0x21, 0xdf, 0x67, 0xe7, 0x3e, 0x15, 0xd2, 0x84, 0xcd, 0xf2, 0x56, 0xcd, + 0xc9, 0x09, 0x70, 0x1d, 0x54, 0x3d, 0x12, 0x0c, 0x35, 0x73, 0x45, 0x33, 0xb3, 0xf7, 0x9d, 0x1b, + 0xbf, 0xf9, 0x7c, 0x73, 0xea, 0xb3, 0xcf, 0x37, 0xa7, 0xfe, 0xf9, 0xf7, 0x5b, 0xeb, 0x49, 0xc7, + 0xe8, 0xb2, 0xc8, 0x4e, 0xba, 0x8b, 0xdd, 0x66, 0x81, 0x24, 0x81, 0xb4, 0xfe, 0x65, 0x80, 0x6b, + 0xed, 0x2c, 0x86, 0x7d, 0x16, 0x21, 0xff, 0xfb, 0xec, 0x15, 0xbb, 0xa0, 0x26, 0xd4, 0x25, 0xea, + 0xea, 0xac, 0xbc, 0x42, 0x75, 0x56, 0x95, 0x9a, 0x62, 0xec, 0x34, 0x5e, 0x72, 0xa2, 0x3f, 0x94, + 0xc0, 0x46, 0x7a, 0xa2, 0x07, 0xcc, 0xa3, 0x4f, 0x28, 0x46, 0xdf, 0x77, 0x0b, 0xcc, 0x52, 0xa3, + 0x32, 0x41, 0x6a, 0x4c, 0xbf, 0x5a, 0x6a, 0xcc, 0x4c, 0x90, 0x1a, 0xb3, 0x2f, 0x4a, 0x8d, 0xea, + 0x68, 0x6a, 0x58, 0x7f, 0x34, 0xc0, 0xea, 0xdd, 0xa7, 0x03, 0x1a, 0xb1, 0xef, 0xe8, 0x62, 0x0e, + 0xc1, 0x3c, 0x29, 0xe0, 0x09, 0xb3, 0xdc, 0x2c, 0x6f, 0xd5, 0x6f, 0xbf, 0x69, 0x27, 0x51, 0xca, + 0xa6, 0x5d, 0x1a, 0xaa, 0xa2, 0x75, 0x67, 0x54, 0x77, 0xa7, 0x64, 0x1a, 0xd6, 0x3f, 0x0c, 0xb0, + 0xae, 0xaa, 0xae, 0x4b, 0x1c, 0x72, 0x8e, 0xb8, 0xb7, 0x4f, 0x02, 0xd6, 0x17, 0xdf, 0xda, 0x4f, + 0x0b, 0xcc, 0x7b, 0x1a, 0xc9, 0x95, 0xcc, 0x45, 0x9e, 0xa7, 0xfd, 0xd4, 0x32, 0x8a, 0x78, 0xc2, + 0x76, 0x3d, 0x0f, 0x6e, 0x81, 0xa5, 0x5c, 0x86, 0xab, 0x82, 0x50, 0x79, 0xaa, 0xc4, 0x16, 0x52, + 0x31, 0x5d, 0x26, 0x2f, 0xcf, 0xc3, 0xff, 0x19, 0x60, 0xe9, 0x43, 0x9f, 0x75, 0x90, 0x7f, 0xec, + 0x23, 0xd1, 0x53, 0x1d, 0x69, 0xa8, 0xf2, 0x9f, 0x93, 0x64, 0x14, 0x68, 0xf7, 0x27, 0xce, 0x7f, + 0xa5, 0xa6, 0x87, 0xd3, 0xfb, 0x60, 0x39, 0x6b, 0xce, 0x59, 0x3e, 0xea, 0xd3, 0xee, 0xad, 0x3c, + 0xfb, 0x7a, 0x73, 0x31, 0xcd, 0xfd, 0xb6, 0xce, 0xcd, 0x7d, 0x67, 0x11, 0x8f, 0x10, 0x3c, 0xd8, + 0x00, 0x75, 0xda, 0xc1, 0xae, 0x20, 0x4f, 0xdd, 0x60, 0xd0, 0xd7, 0xa9, 0x5c, 0x71, 0x6a, 0xb4, + 0x83, 0x8f, 0xc9, 0xd3, 0x87, 0x83, 0x3e, 0x7c, 0x07, 0xbc, 0x9e, 0xae, 0x6c, 0x6e, 0x84, 0x7c, + 0x57, 0xe9, 0xab, 0xeb, 0xe2, 0x3a, 0xbb, 0xe7, 0x9c, 0x95, 0x94, 0x7b, 0x8a, 0x7c, 0x65, 0x6c, + 0xd7, 0xf3, 0xb8, 0xf5, 0x7c, 0x1a, 0xcc, 0x1c, 0x21, 0x8e, 0xfa, 0x02, 0x9e, 0x80, 0x45, 0x49, + 0xfa, 0xa1, 0x8f, 0x24, 0x71, 0xe3, 0xc1, 0x9f, 0x9c, 0xf4, 0xa6, 0x5e, 0x08, 0x8a, 0xeb, 0x95, + 0x5d, 0x58, 0xa8, 0xa2, 0x6d, 0xbb, 0xad, 0xa9, 0xc7, 0x12, 0x49, 0xe2, 0x2c, 0xa4, 0x18, 0x31, + 0x11, 0xde, 0x01, 0xa6, 0xe4, 0x03, 0x21, 0xf3, 0x91, 0x9c, 0xcf, 0xa2, 0x38, 0xd6, 0xaf, 0xa7, + 0xfc, 0x78, 0x8a, 0x65, 0x33, 0xe8, 0xf2, 0xe9, 0x5b, 0xfe, 0x36, 0xd3, 0xf7, 0x18, 0xac, 0xa8, + 0xd5, 0x65, 0x1c, 0xb3, 0x32, 0x39, 0xe6, 0xb2, 0xd2, 0x1f, 0x05, 0xfd, 0x18, 0xc0, 0x48, 0xe0, + 0x71, 0xcc, 0xe9, 0x57, 0xf0, 0x33, 0x12, 0x78, 0x14, 0xd2, 0x03, 0x1b, 0x42, 0x25, 0x9f, 0xdb, + 0x27, 0x52, 0xcf, 0xf2, 0xd0, 0x27, 0x01, 0x15, 0xbd, 0x14, 0x7c, 0x66, 0x72, 0xf0, 0x35, 0x0d, + 0xf4, 0x40, 0xe1, 0x38, 0x29, 0x4c, 0x62, 0xa5, 0x0d, 0x1a, 0x97, 0x5b, 0xc9, 0x02, 0x34, 0xab, + 0x03, 0xf4, 0x83, 0x4b, 0x20, 0xb2, 0x28, 0x09, 0x70, 0xa3, 0xb0, 0x73, 0xa8, 0xaa, 0x77, 0x75, + 0xc1, 0xb9, 0x9c, 0x74, 0xd5, 0x60, 0x46, 0xf1, 0xfa, 0x41, 0x48, 0xb6, 0x37, 0x25, 0xb5, 0xa7, + 0x96, 0xe6, 0x42, 0xf1, 0xd1, 0x20, 0x59, 0x2e, 0xad, 0x7c, 0x35, 0xc9, 0x7a, 0x88, 0x53, 0xc0, + 0xfa, 0x80, 0x10, 0x55, 0xed, 0x85, 0xf5, 0x84, 0x84, 0x0c, 0xf7, 0xf4, 0xfa, 0x54, 0x76, 0x16, + 0xb2, 0x55, 0xe4, 0xae, 0xa2, 0xde, 0xaf, 0x54, 0xab, 0x4b, 0x35, 0xeb, 0x27, 0xa0, 0xa6, 0x8b, + 0x79, 0x17, 0x9f, 0x09, 0xdd, 0x81, 0x3d, 0x8f, 0x13, 0x21, 0x88, 0x30, 0x8d, 0xa4, 0x03, 0xa7, + 0x04, 0x4b, 0x82, 0xb5, 0xab, 0x96, 0x70, 0x01, 0x1f, 0x83, 0xd9, 0x90, 0xe8, 0x0d, 0x51, 0x2b, + 0xd6, 0x6f, 0xbf, 0x67, 0x4f, 0xf0, 0xeb, 0xc9, 0xbe, 0x0a, 0xd0, 0x49, 0xd1, 0x2c, 0x9e, 0xaf, + 0xfe, 0x63, 0xd3, 0x5c, 0xc0, 0xd3, 0x71, 0xa3, 0x3f, 0x7b, 0x25, 0xa3, 0x63, 0x78, 0xb9, 0xcd, + 0x9b, 0xa0, 0xbe, 0x1b, 0x1f, 0xfb, 0x23, 0x35, 0x7a, 0x2e, 0x5c, 0xcb, 0x5c, 0xf1, 0x5a, 0xee, + 0x83, 0x85, 0x64, 0x9f, 0x3a, 0x61, 0xba, 0x21, 0xc1, 0x1f, 0x02, 0x90, 0x2c, 0x62, 0xaa, 0x91, + 0xc5, 0x2d, 0xbd, 0x96, 0x50, 0x0e, 0xbc, 0x91, 0xa9, 0x5b, 0x1a, 0x99, 0xba, 0x96, 0x03, 0x16, + 0x4f, 0x05, 0xfe, 0x79, 0xba, 0x6c, 0x3f, 0x0a, 0x05, 0x7c, 0x0d, 0xcc, 0xa8, 0x1a, 0x4a, 0x80, + 0x2a, 0xce, 0x74, 0x24, 0xf0, 0x81, 0xee, 0xea, 0xf9, 0x42, 0xcf, 0x42, 0x97, 0x7a, 0xc2, 0x2c, + 0x35, 0xcb, 0x5b, 0x15, 0x67, 0x61, 0x90, 0xab, 0x1f, 0x78, 0xc2, 0xfa, 0x05, 0xa8, 0x17, 0x00, + 0xe1, 0x02, 0x28, 0x65, 0x58, 0x25, 0xea, 0xc1, 0x1d, 0xb0, 0x96, 0x03, 0x8d, 0xb6, 0xe1, 0x18, + 0xb1, 0xe6, 0x5c, 0xcb, 0x04, 0x46, 0x3a, 0xb1, 0xb0, 0x1e, 0x81, 0xd5, 0x83, 0xbc, 0xe8, 0xb3, + 0x26, 0x3f, 0x72, 0x42, 0x63, 0x74, 0xaf, 0xd8, 0x00, 0xb5, 0xec, 0x37, 0xae, 0x3e, 0x7d, 0xc5, + 0xc9, 0x09, 0x56, 0x1f, 0x2c, 0x9d, 0x0a, 0x7c, 0x4c, 0x02, 0x2f, 0x07, 0xbb, 0xe2, 0x02, 0xf6, + 0xc6, 0x81, 0x26, 0xfe, 0x55, 0x94, 0x9b, 0x63, 0x60, 0xed, 0xb4, 0xb8, 0x84, 0xe8, 0x01, 0x7d, + 0x84, 0xf0, 0x19, 0x91, 0x02, 0x3a, 0xa0, 0xa2, 0x97, 0x8d, 0x38, 0xb3, 0xee, 0x5c, 0x99, 0x59, + 0xd1, 0xb6, 0x7d, 0x15, 0xc8, 0x3e, 0x92, 0x28, 0xa9, 0x5d, 0x8d, 0x65, 0xfd, 0x18, 0xac, 0x3c, + 0x40, 0x72, 0xc0, 0x89, 0x37, 0x12, 0xe3, 0x25, 0x50, 0x56, 0xf1, 0x33, 0x74, 0xfc, 0xd4, 0xa3, + 0xf5, 0x67, 0x03, 0x98, 0x77, 0x3f, 0x09, 0x19, 0x97, 0xc4, 0xbb, 0x70, 0x23, 0x2f, 0xb8, 0xde, + 0x33, 0xb0, 0xa2, 0x2e, 0x4b, 0x90, 0xc0, 0x73, 0xb3, 0x73, 0xc6, 0x71, 0xac, 0xdf, 0x7e, 0x77, + 0xa2, 0xea, 0x18, 0x37, 0x97, 0x1c, 0x60, 0x39, 0x1a, 0xa3, 0x0b, 0xeb, 0x77, 0x06, 0x30, 0x0f, + 0xc9, 0x70, 0x57, 0x08, 0xda, 0x0d, 0xfa, 0x24, 0x90, 0xaa, 0x07, 0x22, 0x4c, 0xd4, 0x23, 0x7c, + 0x03, 0xcc, 0x67, 0x33, 0x57, 0x8f, 0x5a, 0x43, 0x8f, 0xda, 0xb9, 0x94, 0xa8, 0x0a, 0x0c, 0xee, + 0x00, 0x10, 0x72, 0x12, 0xb9, 0xd8, 0x3d, 0x23, 0xc3, 0x24, 0x8a, 0x1b, 0xc5, 0x11, 0x1a, 0x7f, + 0x81, 0xb0, 0x8f, 0x06, 0x1d, 0x9f, 0xe2, 0x43, 0x32, 0x74, 0xaa, 0x4a, 0xbe, 0x7d, 0x48, 0x86, + 0x6a, 0x67, 0xd2, 0x1b, 0xa8, 0x9e, 0x7b, 0x65, 0x27, 0x7e, 0xb1, 0x7e, 0x6f, 0x80, 0x6b, 0x59, + 0x38, 0xd2, 0x74, 0x3d, 0x1a, 0x74, 0x94, 0xc6, 0x0b, 0xee, 0xed, 0x82, 0xb7, 0xa5, 0x4b, 0xbc, + 0x7d, 0x1f, 0xcc, 0x65, 0x05, 0xa2, 0xfc, 0x2d, 0x4f, 0xe0, 0x6f, 0x3d, 0xd5, 0x38, 0x24, 0x43, + 0xeb, 0xd7, 0x05, 0xdf, 0xf6, 0x86, 0x85, 0xde, 0xc7, 0x5f, 0xe2, 0x5b, 0x66, 0xb6, 0xe8, 0x1b, + 0x2e, 0xea, 0x5f, 0x38, 0x40, 0xf9, 0xe2, 0x01, 0xac, 0x3f, 0x19, 0x60, 0xb5, 0x68, 0x55, 0x9c, + 0xb0, 0x23, 0x3e, 0x08, 0xc8, 0x8b, 0xac, 0xe7, 0xe5, 0x57, 0x2a, 0x96, 0xdf, 0x63, 0xb0, 0x30, + 0xe2, 0x94, 0x48, 0x6e, 0xe3, 0xed, 0x89, 0x72, 0xac, 0xd0, 0x5d, 0x9d, 0xf9, 0xe2, 0x39, 0x84, + 0xf5, 0x17, 0x03, 0x2c, 0xa7, 0x3e, 0x66, 0x97, 0x05, 0x7f, 0x0a, 0x60, 0x76, 0xbc, 0x7c, 0x7b, + 0x8b, 0x53, 0x6a, 0x29, 0xe5, 0xa4, 0xab, 0x5b, 0x9e, 0x1a, 0xa5, 0x42, 0x6a, 0xc0, 0x8f, 0xc0, + 0x4a, 0xe6, 0x72, 0xa8, 0x03, 0x34, 0x71, 0x14, 0xb3, 0xfd, 0x34, 0x23, 0x59, 0xbf, 0x35, 0xf2, + 0x71, 0x18, 0xcf, 0x63, 0xb1, 0xeb, 0xfb, 0xc9, 0xd2, 0x0f, 0x43, 0x30, 0x1b, 0x8f, 0x7c, 0x91, + 0xf4, 0x8f, 0x8d, 0x4b, 0x87, 0xfb, 0x3e, 0xc1, 0x7a, 0xbe, 0xdf, 0x51, 0x25, 0xf6, 0xc5, 0x37, + 0x9b, 0x37, 0xbb, 0x54, 0xf6, 0x06, 0x1d, 0x1b, 0xb3, 0x7e, 0xf2, 0x51, 0x2c, 0xf9, 0x77, 0x4b, + 0x78, 0x67, 0x2d, 0x39, 0x0c, 0x89, 0x48, 0x75, 0xc4, 0x5f, 0xff, 0xfb, 0xb7, 0xb7, 0x0c, 0x27, + 0x35, 0xb3, 0xf7, 0xf8, 0xcb, 0x67, 0x0d, 0xe3, 0xab, 0x67, 0x0d, 0xe3, 0x3f, 0xcf, 0x1a, 0xc6, + 0xa7, 0xcf, 0x1b, 0x53, 0x5f, 0x3d, 0x6f, 0x4c, 0xfd, 0xfb, 0x79, 0x63, 0xea, 0x97, 0xef, 0x5d, + 0x04, 0xcd, 0x63, 0x74, 0x2b, 0xfb, 0x66, 0x19, 0xbd, 0xdb, 0xfa, 0x64, 0xf4, 0x8b, 0xa8, 0xb6, + 0xd7, 0x99, 0xd1, 0xdd, 0xf4, 0x9d, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x62, 0x6f, 0xc0, 0x43, + 0x42, 0x15, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -1629,6 +1831,47 @@ func (m *ConsumerAdditionProposal) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if len(m.Denylist) > 0 { + for iNdEx := len(m.Denylist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denylist[iNdEx]) + copy(dAtA[i:], m.Denylist[iNdEx]) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Denylist[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + } + } + if len(m.Allowlist) > 0 { + for iNdEx := len(m.Allowlist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Allowlist[iNdEx]) + copy(dAtA[i:], m.Allowlist[iNdEx]) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Allowlist[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + } + if m.ValidatorSetCap != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorSetCap)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.ValidatorsPowerCap != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorsPowerCap)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if m.Top_N != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.Top_N)) + i-- + dAtA[i] = 0x78 + } if len(m.DistributionTransmissionChannel) > 0 { i -= len(m.DistributionTransmissionChannel) copy(dAtA[i:], m.DistributionTransmissionChannel) @@ -1785,6 +2028,83 @@ func (m *ConsumerRemovalProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *ConsumerModificationProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerModificationProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerModificationProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denylist) > 0 { + for iNdEx := len(m.Denylist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denylist[iNdEx]) + copy(dAtA[i:], m.Denylist[iNdEx]) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Denylist[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } + if len(m.Allowlist) > 0 { + for iNdEx := len(m.Allowlist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Allowlist[iNdEx]) + copy(dAtA[i:], m.Allowlist[iNdEx]) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Allowlist[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if m.ValidatorSetCap != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorSetCap)) + i-- + dAtA[i] = 0x30 + } + if m.ValidatorsPowerCap != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.ValidatorsPowerCap)) + i-- + dAtA[i] = 0x28 + } + if m.Top_N != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.Top_N)) + i-- + dAtA[i] = 0x20 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *EquivocationProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2722,6 +3042,43 @@ func (m *ConsumerValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ConsumerRewardsAllocation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerRewardsAllocation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerRewardsAllocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Rewards) > 0 { + for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintProvider(dAtA []byte, offset int, v uint64) int { offset -= sovProvider(v) base := offset @@ -2783,6 +3140,27 @@ func (m *ConsumerAdditionProposal) Size() (n int) { if l > 0 { n += 1 + l + sovProvider(uint64(l)) } + if m.Top_N != 0 { + n += 1 + sovProvider(uint64(m.Top_N)) + } + if m.ValidatorsPowerCap != 0 { + n += 2 + sovProvider(uint64(m.ValidatorsPowerCap)) + } + if m.ValidatorSetCap != 0 { + n += 2 + sovProvider(uint64(m.ValidatorSetCap)) + } + if len(m.Allowlist) > 0 { + for _, s := range m.Allowlist { + l = len(s) + n += 2 + l + sovProvider(uint64(l)) + } + } + if len(m.Denylist) > 0 { + for _, s := range m.Denylist { + l = len(s) + n += 2 + l + sovProvider(uint64(l)) + } + } return n } @@ -2809,7 +3187,7 @@ func (m *ConsumerRemovalProposal) Size() (n int) { return n } -func (m *EquivocationProposal) Size() (n int) { +func (m *ConsumerModificationProposal) Size() (n int) { if m == nil { return 0 } @@ -2823,9 +3201,51 @@ func (m *EquivocationProposal) Size() (n int) { if l > 0 { n += 1 + l + sovProvider(uint64(l)) } - if len(m.Equivocations) > 0 { - for _, e := range m.Equivocations { - l = e.Size() + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + if m.Top_N != 0 { + n += 1 + sovProvider(uint64(m.Top_N)) + } + if m.ValidatorsPowerCap != 0 { + n += 1 + sovProvider(uint64(m.ValidatorsPowerCap)) + } + if m.ValidatorSetCap != 0 { + n += 1 + sovProvider(uint64(m.ValidatorSetCap)) + } + if len(m.Allowlist) > 0 { + for _, s := range m.Allowlist { + l = len(s) + n += 1 + l + sovProvider(uint64(l)) + } + } + if len(m.Denylist) > 0 { + for _, s := range m.Denylist { + l = len(s) + n += 1 + l + sovProvider(uint64(l)) + } + } + return n +} + +func (m *EquivocationProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + if len(m.Equivocations) > 0 { + for _, e := range m.Equivocations { + l = e.Size() n += 1 + l + sovProvider(uint64(l)) } } @@ -3213,6 +3633,21 @@ func (m *ConsumerValidator) Size() (n int) { return n } +func (m *ConsumerRewardsAllocation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rewards) > 0 { + for _, e := range m.Rewards { + l = e.Size() + n += 1 + l + sovProvider(uint64(l)) + } + } + return n +} + func sovProvider(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3546,9 +3981,315 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 10: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransferTimeoutPeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TransferTimeoutPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.TransferTimeoutPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerRedistributionFraction", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerRedistributionFraction = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerDistributionTransmission", wireType) + } + m.BlocksPerDistributionTransmission = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlocksPerDistributionTransmission |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) + } + m.HistoricalEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HistoricalEntries |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionTransmissionChannel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DistributionTransmissionChannel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Top_N", wireType) + } + m.Top_N = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Top_N |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsPowerCap", wireType) + } + m.ValidatorsPowerCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorsPowerCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetCap", wireType) + } + m.ValidatorSetCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorSetCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denylist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsumerRemovalProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerRemovalProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerRemovalProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -3558,28 +4299,27 @@ func (m *ConsumerAdditionProposal) 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 ErrInvalidLengthProvider } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.TransferTimeoutPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Title = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 11: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerRedistributionFraction", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3607,13 +4347,13 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsumerRedistributionFraction = string(dAtA[iNdEx:postIndex]) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerDistributionTransmission", wireType) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } - m.BlocksPerDistributionTransmission = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -3623,35 +4363,29 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlocksPerDistributionTransmission |= int64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider } - m.HistoricalEntries = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HistoricalEntries |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider } - case 14: + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistributionTransmissionChannel", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StopTime", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -3661,23 +4395,24 @@ func (m *ConsumerAdditionProposal) 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 ErrInvalidLengthProvider } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - m.DistributionTransmissionChannel = string(dAtA[iNdEx:postIndex]) + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StopTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3700,7 +4435,7 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { } return nil } -func (m *ConsumerRemovalProposal) Unmarshal(dAtA []byte) error { +func (m *ConsumerModificationProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3723,10 +4458,10 @@ func (m *ConsumerRemovalProposal) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConsumerRemovalProposal: wiretype end group for non-group") + return fmt.Errorf("proto: ConsumerModificationProposal: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerRemovalProposal: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsumerModificationProposal: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3826,10 +4561,67 @@ func (m *ConsumerRemovalProposal) Unmarshal(dAtA []byte) error { m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Top_N", wireType) + } + m.Top_N = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Top_N |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsPowerCap", wireType) + } + m.ValidatorsPowerCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorsPowerCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetCap", wireType) + } + m.ValidatorSetCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorSetCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StopTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -3839,24 +4631,55 @@ func (m *ConsumerRemovalProposal) 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 ErrInvalidLengthProvider } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StopTime, dAtA[iNdEx:postIndex]); err != nil { - return err + m.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denylist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF } + m.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -6645,6 +7468,90 @@ func (m *ConsumerValidator) Unmarshal(dAtA []byte) error { } return nil } +func (m *ConsumerRewardsAllocation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerRewardsAllocation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerRewardsAllocation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rewards = append(m.Rewards, types2.DecCoin{}) + if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipProvider(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index 949934e025..e8c13f7d3c 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -5,8 +5,11 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -374,6 +377,21 @@ func (m *QueryConsumerChainStopProposalsResponse) GetProposals() *ConsumerRemova type Chain struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // If chain with `chainID` is a Top-N chain, i.e., enforces at least one validator to validate chain `chainID` + Top_N uint32 `protobuf:"varint,3,opt,name=top_N,json=topN,proto3" json:"top_N,omitempty"` + // If the chain is a Top-N chain, this is the minimum power required to be in the top N. + // Otherwise, this is -1. + MinPowerInTop_N int64 `protobuf:"varint,4,opt,name=min_power_in_top_N,json=minPowerInTopN,proto3" json:"min_power_in_top_N,omitempty"` + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. + ValidatorsPowerCap uint32 `protobuf:"varint,5,opt,name=validators_power_cap,json=validatorsPowerCap,proto3" json:"validators_power_cap,omitempty"` + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + ValidatorSetCap uint32 `protobuf:"varint,6,opt,name=validator_set_cap,json=validatorSetCap,proto3" json:"validator_set_cap,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + Allowlist []string `protobuf:"bytes,7,rep,name=allowlist,proto3" json:"allowlist,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + Denylist []string `protobuf:"bytes,8,rep,name=denylist,proto3" json:"denylist,omitempty"` } func (m *Chain) Reset() { *m = Chain{} } @@ -423,6 +441,48 @@ func (m *Chain) GetClientId() string { return "" } +func (m *Chain) GetTop_N() uint32 { + if m != nil { + return m.Top_N + } + return 0 +} + +func (m *Chain) GetMinPowerInTop_N() int64 { + if m != nil { + return m.MinPowerInTop_N + } + return 0 +} + +func (m *Chain) GetValidatorsPowerCap() uint32 { + if m != nil { + return m.ValidatorsPowerCap + } + return 0 +} + +func (m *Chain) GetValidatorSetCap() uint32 { + if m != nil { + return m.ValidatorSetCap + } + return 0 +} + +func (m *Chain) GetAllowlist() []string { + if m != nil { + return m.Allowlist + } + return nil +} + +func (m *Chain) GetDenylist() []string { + if m != nil { + return m.Denylist + } + return nil +} + type QueryValidatorConsumerAddrRequest struct { // The id of the consumer chain ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -1153,22 +1213,26 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -type QueryOldestUnconfirmedVscRequest struct { +type QueryConsumerChainOptedInValidatorsRequest struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func (m *QueryOldestUnconfirmedVscRequest) Reset() { *m = QueryOldestUnconfirmedVscRequest{} } -func (m *QueryOldestUnconfirmedVscRequest) String() string { return proto.CompactTextString(m) } -func (*QueryOldestUnconfirmedVscRequest) ProtoMessage() {} -func (*QueryOldestUnconfirmedVscRequest) Descriptor() ([]byte, []int) { +func (m *QueryConsumerChainOptedInValidatorsRequest) Reset() { + *m = QueryConsumerChainOptedInValidatorsRequest{} +} +func (m *QueryConsumerChainOptedInValidatorsRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryConsumerChainOptedInValidatorsRequest) ProtoMessage() {} +func (*QueryConsumerChainOptedInValidatorsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_422512d7b7586cd7, []int{25} } -func (m *QueryOldestUnconfirmedVscRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryConsumerChainOptedInValidatorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryOldestUnconfirmedVscRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryConsumerChainOptedInValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryOldestUnconfirmedVscRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryConsumerChainOptedInValidatorsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1178,41 +1242,46 @@ func (m *QueryOldestUnconfirmedVscRequest) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *QueryOldestUnconfirmedVscRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOldestUnconfirmedVscRequest.Merge(m, src) +func (m *QueryConsumerChainOptedInValidatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerChainOptedInValidatorsRequest.Merge(m, src) } -func (m *QueryOldestUnconfirmedVscRequest) XXX_Size() int { +func (m *QueryConsumerChainOptedInValidatorsRequest) XXX_Size() int { return m.Size() } -func (m *QueryOldestUnconfirmedVscRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOldestUnconfirmedVscRequest.DiscardUnknown(m) +func (m *QueryConsumerChainOptedInValidatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerChainOptedInValidatorsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryOldestUnconfirmedVscRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryConsumerChainOptedInValidatorsRequest proto.InternalMessageInfo -func (m *QueryOldestUnconfirmedVscRequest) GetChainId() string { +func (m *QueryConsumerChainOptedInValidatorsRequest) GetChainId() string { if m != nil { return m.ChainId } return "" } -type QueryOldestUnconfirmedVscResponse struct { - VscSendTimestamp VscSendTimestamp `protobuf:"bytes,1,opt,name=vsc_send_timestamp,json=vscSendTimestamp,proto3" json:"vsc_send_timestamp"` +type QueryConsumerChainOptedInValidatorsResponse struct { + // The consensus addresses of the validators on the provider chain + ValidatorsProviderAddresses []string `protobuf:"bytes,1,rep,name=validators_provider_addresses,json=validatorsProviderAddresses,proto3" json:"validators_provider_addresses,omitempty"` } -func (m *QueryOldestUnconfirmedVscResponse) Reset() { *m = QueryOldestUnconfirmedVscResponse{} } -func (m *QueryOldestUnconfirmedVscResponse) String() string { return proto.CompactTextString(m) } -func (*QueryOldestUnconfirmedVscResponse) ProtoMessage() {} -func (*QueryOldestUnconfirmedVscResponse) Descriptor() ([]byte, []int) { +func (m *QueryConsumerChainOptedInValidatorsResponse) Reset() { + *m = QueryConsumerChainOptedInValidatorsResponse{} +} +func (m *QueryConsumerChainOptedInValidatorsResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryConsumerChainOptedInValidatorsResponse) ProtoMessage() {} +func (*QueryConsumerChainOptedInValidatorsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_422512d7b7586cd7, []int{26} } -func (m *QueryOldestUnconfirmedVscResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryConsumerChainOptedInValidatorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryOldestUnconfirmedVscResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryConsumerChainOptedInValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryOldestUnconfirmedVscResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryConsumerChainOptedInValidatorsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1222,1472 +1291,1314 @@ func (m *QueryOldestUnconfirmedVscResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *QueryOldestUnconfirmedVscResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOldestUnconfirmedVscResponse.Merge(m, src) +func (m *QueryConsumerChainOptedInValidatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerChainOptedInValidatorsResponse.Merge(m, src) } -func (m *QueryOldestUnconfirmedVscResponse) XXX_Size() int { +func (m *QueryConsumerChainOptedInValidatorsResponse) XXX_Size() int { return m.Size() } -func (m *QueryOldestUnconfirmedVscResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOldestUnconfirmedVscResponse.DiscardUnknown(m) +func (m *QueryConsumerChainOptedInValidatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerChainOptedInValidatorsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryOldestUnconfirmedVscResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryConsumerChainOptedInValidatorsResponse proto.InternalMessageInfo -func (m *QueryOldestUnconfirmedVscResponse) GetVscSendTimestamp() VscSendTimestamp { +func (m *QueryConsumerChainOptedInValidatorsResponse) GetValidatorsProviderAddresses() []string { if m != nil { - return m.VscSendTimestamp + return m.ValidatorsProviderAddresses } - return VscSendTimestamp{} + return nil } -func init() { - proto.RegisterType((*QueryConsumerGenesisRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisRequest") - proto.RegisterType((*QueryConsumerGenesisResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisResponse") - proto.RegisterType((*QueryConsumerChainsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsRequest") - proto.RegisterType((*QueryConsumerChainsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsResponse") - proto.RegisterType((*QueryConsumerChainStartProposalsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStartProposalsRequest") - proto.RegisterType((*QueryConsumerChainStartProposalsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStartProposalsResponse") - proto.RegisterType((*QueryConsumerChainStopProposalsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStopProposalsRequest") - proto.RegisterType((*QueryConsumerChainStopProposalsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStopProposalsResponse") - proto.RegisterType((*Chain)(nil), "interchain_security.ccv.provider.v1.Chain") - proto.RegisterType((*QueryValidatorConsumerAddrRequest)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerAddrRequest") - proto.RegisterType((*QueryValidatorConsumerAddrResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerAddrResponse") - proto.RegisterType((*QueryValidatorProviderAddrRequest)(nil), "interchain_security.ccv.provider.v1.QueryValidatorProviderAddrRequest") - proto.RegisterType((*QueryValidatorProviderAddrResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorProviderAddrResponse") - proto.RegisterType((*QueryThrottleStateRequest)(nil), "interchain_security.ccv.provider.v1.QueryThrottleStateRequest") - proto.RegisterType((*QueryThrottleStateResponse)(nil), "interchain_security.ccv.provider.v1.QueryThrottleStateResponse") - proto.RegisterType((*QueryRegisteredConsumerRewardDenomsRequest)(nil), "interchain_security.ccv.provider.v1.QueryRegisteredConsumerRewardDenomsRequest") - proto.RegisterType((*QueryRegisteredConsumerRewardDenomsResponse)(nil), "interchain_security.ccv.provider.v1.QueryRegisteredConsumerRewardDenomsResponse") - proto.RegisterType((*QueryProposedChainIDsRequest)(nil), "interchain_security.ccv.provider.v1.QueryProposedChainIDsRequest") - proto.RegisterType((*QueryProposedChainIDsResponse)(nil), "interchain_security.ccv.provider.v1.QueryProposedChainIDsResponse") - proto.RegisterType((*ProposedChain)(nil), "interchain_security.ccv.provider.v1.ProposedChain") - proto.RegisterType((*QueryAllPairsValConAddrByConsumerChainIDRequest)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConAddrByConsumerChainIDRequest") - proto.RegisterType((*QueryAllPairsValConAddrByConsumerChainIDResponse)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConAddrByConsumerChainIDResponse") - proto.RegisterType((*PairValConAddrProviderAndConsumer)(nil), "interchain_security.ccv.provider.v1.PairValConAddrProviderAndConsumer") - proto.RegisterType((*QueryParamsRequest)(nil), "interchain_security.ccv.provider.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "interchain_security.ccv.provider.v1.QueryParamsResponse") - proto.RegisterType((*QueryOldestUnconfirmedVscRequest)(nil), "interchain_security.ccv.provider.v1.QueryOldestUnconfirmedVscRequest") - proto.RegisterType((*QueryOldestUnconfirmedVscResponse)(nil), "interchain_security.ccv.provider.v1.QueryOldestUnconfirmedVscResponse") +type QueryConsumerValidatorsRequest struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func init() { - proto.RegisterFile("interchain_security/ccv/provider/v1/query.proto", fileDescriptor_422512d7b7586cd7) +func (m *QueryConsumerValidatorsRequest) Reset() { *m = QueryConsumerValidatorsRequest{} } +func (m *QueryConsumerValidatorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryConsumerValidatorsRequest) ProtoMessage() {} +func (*QueryConsumerValidatorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{27} } - -var fileDescriptor_422512d7b7586cd7 = []byte{ - // 1525 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcf, 0x6f, 0xd4, 0x46, - 0x1b, 0x8e, 0x13, 0xc8, 0x97, 0x4c, 0xf8, 0xf5, 0x0d, 0x7c, 0x10, 0x9c, 0x7c, 0xbb, 0x60, 0xd4, - 0x36, 0x40, 0x6b, 0x27, 0x8b, 0x50, 0xf9, 0xd1, 0x10, 0x76, 0xf3, 0x83, 0xae, 0x02, 0x22, 0x35, - 0x90, 0x4a, 0x6d, 0x55, 0xe3, 0xd8, 0xc3, 0xc6, 0xc2, 0xeb, 0x31, 0x33, 0xde, 0x85, 0x15, 0xea, - 0x81, 0x1e, 0x5a, 0x4e, 0x15, 0x52, 0xdb, 0x3b, 0x97, 0xfe, 0x03, 0xfd, 0x2b, 0xe8, 0xa9, 0x54, - 0x5c, 0x7a, 0xa2, 0x55, 0xe8, 0xa1, 0xea, 0xa9, 0x42, 0x95, 0x7a, 0xaa, 0x54, 0x79, 0x3c, 0xf6, - 0xda, 0xbb, 0xde, 0x5d, 0xef, 0x26, 0xb7, 0x64, 0x3c, 0xef, 0xf3, 0x3e, 0xcf, 0xeb, 0x77, 0xde, - 0x79, 0xbc, 0x40, 0xb1, 0x1c, 0x0f, 0x11, 0x63, 0x53, 0xb7, 0x1c, 0x8d, 0x22, 0xa3, 0x46, 0x2c, - 0xaf, 0xa1, 0x18, 0x46, 0x5d, 0x71, 0x09, 0xae, 0x5b, 0x26, 0x22, 0x4a, 0x7d, 0x4e, 0xb9, 0x57, - 0x43, 0xa4, 0x21, 0xbb, 0x04, 0x7b, 0x18, 0x9e, 0x48, 0x09, 0x90, 0x0d, 0xa3, 0x2e, 0x87, 0x01, - 0x72, 0x7d, 0x4e, 0x9c, 0xae, 0x60, 0x5c, 0xb1, 0x91, 0xa2, 0xbb, 0x96, 0xa2, 0x3b, 0x0e, 0xf6, - 0x74, 0xcf, 0xc2, 0x0e, 0x0d, 0x20, 0xc4, 0x43, 0x15, 0x5c, 0xc1, 0xec, 0x4f, 0xc5, 0xff, 0x8b, - 0xaf, 0xe6, 0x79, 0x0c, 0xfb, 0x6f, 0xa3, 0x76, 0x47, 0xf1, 0xac, 0x2a, 0xa2, 0x9e, 0x5e, 0x75, - 0xf9, 0x86, 0x42, 0x16, 0xaa, 0x11, 0x8b, 0x20, 0x66, 0xb6, 0x53, 0x4c, 0x7d, 0x4e, 0xa1, 0x9b, - 0x3a, 0x41, 0xa6, 0x66, 0x60, 0x87, 0xd6, 0xaa, 0x51, 0xc4, 0x1b, 0x5d, 0x22, 0xee, 0x5b, 0x04, - 0xf1, 0x6d, 0xd3, 0x1e, 0x72, 0x4c, 0x44, 0xaa, 0x96, 0xe3, 0x29, 0x06, 0x69, 0xb8, 0x1e, 0x56, - 0xee, 0xa2, 0x06, 0x57, 0x28, 0x9d, 0x03, 0x53, 0x1f, 0xf8, 0x35, 0x5b, 0xe4, 0xd8, 0x57, 0x90, - 0x83, 0xa8, 0x45, 0x55, 0x74, 0xaf, 0x86, 0xa8, 0x07, 0x8f, 0x82, 0xb1, 0x20, 0x81, 0x65, 0x4e, - 0x0a, 0xc7, 0x84, 0x99, 0x71, 0xf5, 0x3f, 0xec, 0xff, 0xb2, 0x29, 0x3d, 0x04, 0xd3, 0xe9, 0x91, - 0xd4, 0xc5, 0x0e, 0x45, 0xf0, 0x63, 0xb0, 0xb7, 0x12, 0x2c, 0x69, 0xd4, 0xd3, 0x3d, 0xc4, 0xe2, - 0x27, 0x0a, 0xb3, 0x72, 0xa7, 0xd7, 0x52, 0x9f, 0x93, 0x5b, 0xb0, 0x6e, 0xf8, 0x71, 0xa5, 0x5d, - 0xcf, 0x5e, 0xe6, 0x87, 0xd4, 0x3d, 0x95, 0xd8, 0x9a, 0x34, 0x0d, 0xc4, 0x44, 0xf2, 0x45, 0x1f, - 0x2e, 0x64, 0x2d, 0xe9, 0x2d, 0xa2, 0xc2, 0xa7, 0x9c, 0x59, 0x09, 0x8c, 0xb2, 0xf4, 0x74, 0x52, - 0x38, 0x36, 0x32, 0x33, 0x51, 0x38, 0x25, 0x67, 0xe8, 0x14, 0x99, 0x81, 0xa8, 0x3c, 0x52, 0x3a, - 0x09, 0xde, 0x6a, 0x4f, 0x71, 0xc3, 0xd3, 0x89, 0xb7, 0x46, 0xb0, 0x8b, 0xa9, 0x6e, 0x47, 0x6c, - 0x1e, 0x0b, 0x60, 0xa6, 0xf7, 0x5e, 0xce, 0xed, 0x13, 0x30, 0xee, 0x86, 0x8b, 0xbc, 0x62, 0x97, - 0xb2, 0xd1, 0xe3, 0xe0, 0x45, 0xd3, 0xb4, 0xfc, 0x16, 0x6e, 0x42, 0x37, 0x01, 0xa5, 0x19, 0xf0, - 0x66, 0x1a, 0x13, 0xec, 0xb6, 0x91, 0xfe, 0x42, 0x48, 0x17, 0x98, 0xd8, 0x1a, 0xbd, 0xe9, 0x36, - 0xce, 0xf3, 0x7d, 0x71, 0x56, 0x51, 0x15, 0xd7, 0x75, 0x3b, 0x95, 0xf2, 0x02, 0xd8, 0xcd, 0x52, - 0x77, 0x69, 0x45, 0x38, 0x05, 0xc6, 0x0d, 0xdb, 0x42, 0x8e, 0xe7, 0x3f, 0x1b, 0x66, 0xcf, 0xc6, - 0x82, 0x85, 0xb2, 0x29, 0x7d, 0x29, 0x80, 0xe3, 0x4c, 0xc9, 0xba, 0x6e, 0x5b, 0xa6, 0xee, 0x61, - 0x12, 0x2b, 0x15, 0xe9, 0xdd, 0xe8, 0x70, 0x1e, 0x1c, 0x08, 0x49, 0x6b, 0xba, 0x69, 0x12, 0x44, - 0x69, 0x90, 0xa4, 0x04, 0x5f, 0xbf, 0xcc, 0xef, 0x6b, 0xe8, 0x55, 0xfb, 0x82, 0xc4, 0x1f, 0x48, - 0xea, 0xfe, 0x70, 0x6f, 0x31, 0x58, 0xb9, 0x30, 0xf6, 0xf8, 0x69, 0x7e, 0xe8, 0xf7, 0xa7, 0xf9, - 0x21, 0xe9, 0x3a, 0x90, 0xba, 0x11, 0xe1, 0xd5, 0x3c, 0x09, 0x0e, 0x84, 0x07, 0x3d, 0x4a, 0x17, - 0x30, 0xda, 0x6f, 0xc4, 0xf6, 0xfb, 0xc9, 0xda, 0xa5, 0xad, 0xc5, 0x92, 0x67, 0x93, 0xd6, 0x96, - 0xab, 0x8b, 0xb4, 0x96, 0xfc, 0xdd, 0xa4, 0x25, 0x89, 0x34, 0xa5, 0xb5, 0x55, 0x92, 0x4b, 0x6b, - 0xa9, 0x9a, 0x34, 0x05, 0x8e, 0x32, 0xc0, 0x9b, 0x9b, 0x04, 0x7b, 0x9e, 0x8d, 0xd8, 0xb1, 0x0f, - 0x9b, 0xf3, 0x27, 0x81, 0x1f, 0xff, 0x96, 0xa7, 0x3c, 0x4d, 0x1e, 0x4c, 0x50, 0x5b, 0xa7, 0x9b, - 0x5a, 0x15, 0x79, 0x88, 0xb0, 0x0c, 0x23, 0x2a, 0x60, 0x4b, 0xd7, 0xfc, 0x15, 0x58, 0x00, 0xff, - 0x8b, 0x6d, 0xd0, 0x74, 0xdb, 0xc6, 0xf7, 0x75, 0xc7, 0x40, 0x4c, 0xfb, 0x88, 0x7a, 0xb0, 0xb9, - 0xb5, 0x18, 0x3e, 0x82, 0x9f, 0x82, 0x49, 0x07, 0x3d, 0xf0, 0x34, 0x82, 0x5c, 0x1b, 0x39, 0x16, - 0xdd, 0xd4, 0x0c, 0xdd, 0x31, 0x7d, 0xb1, 0x68, 0x72, 0x84, 0xf5, 0xbc, 0x28, 0x07, 0xf7, 0x82, - 0x1c, 0xde, 0x0b, 0xf2, 0xcd, 0xf0, 0x5e, 0x28, 0x8d, 0xf9, 0x33, 0xec, 0xc9, 0x2f, 0x79, 0x41, - 0x3d, 0xec, 0xa3, 0xa8, 0x21, 0xc8, 0x62, 0x88, 0x21, 0xbd, 0x0d, 0x4e, 0x31, 0x49, 0x2a, 0xaa, - 0x58, 0xd4, 0x43, 0x04, 0x99, 0xcd, 0xd3, 0x71, 0x5f, 0x27, 0xe6, 0x12, 0x72, 0x70, 0x35, 0x3a, - 0x9e, 0xcb, 0xe0, 0x74, 0xa6, 0xdd, 0xbc, 0x22, 0x87, 0xc1, 0xa8, 0xc9, 0x56, 0xd8, 0xc4, 0x1b, - 0x57, 0xf9, 0x7f, 0x52, 0x8e, 0xcf, 0xf0, 0xe0, 0xe4, 0x21, 0x93, 0x9d, 0xb4, 0xf2, 0x52, 0x94, - 0xe6, 0x91, 0x00, 0xfe, 0xdf, 0x61, 0x03, 0x47, 0xbe, 0x0d, 0xf6, 0xb9, 0xf1, 0x67, 0xe1, 0x4c, - 0x2d, 0x64, 0x1a, 0x00, 0x09, 0x58, 0x3e, 0xe8, 0x5b, 0xf0, 0xa4, 0x32, 0xd8, 0x9b, 0xd8, 0x06, - 0x27, 0x01, 0xef, 0xdf, 0xa5, 0x64, 0x3b, 0x2f, 0xc1, 0x1c, 0x00, 0xe1, 0xe0, 0x28, 0x2f, 0xb1, - 0x97, 0xb9, 0x4b, 0x8d, 0xad, 0x48, 0x57, 0x81, 0xc2, 0xd4, 0x14, 0x6d, 0x7b, 0x4d, 0xb7, 0x08, - 0x5d, 0xd7, 0xed, 0x45, 0xec, 0xf8, 0x2d, 0x57, 0x4a, 0xce, 0xb9, 0xf2, 0x52, 0x86, 0x0b, 0xf0, - 0x3b, 0x01, 0xcc, 0x66, 0x87, 0xe3, 0xf5, 0xba, 0x07, 0xfe, 0xeb, 0xea, 0x16, 0xd1, 0xea, 0xba, - 0xed, 0xdf, 0xe7, 0xec, 0x18, 0xf0, 0x92, 0xad, 0x64, 0x2b, 0x99, 0x6e, 0x91, 0x66, 0xa2, 0xe8, - 0x98, 0x39, 0xcd, 0x06, 0xd8, 0xe7, 0x26, 0xb6, 0x48, 0x7f, 0x09, 0xe0, 0x78, 0xcf, 0x28, 0xb8, - 0xd2, 0xe9, 0x6c, 0x96, 0xa6, 0x5e, 0xbf, 0xcc, 0x1f, 0x09, 0x46, 0x41, 0xeb, 0x8e, 0xf6, 0x71, - 0xe7, 0xe3, 0x74, 0x18, 0x29, 0x31, 0x9c, 0xd6, 0x1d, 0xed, 0xb3, 0x05, 0x2e, 0x80, 0x3d, 0xd1, - 0xae, 0xbb, 0xa8, 0xc1, 0xcf, 0xd8, 0xb4, 0xdc, 0x74, 0x33, 0x72, 0xe0, 0x66, 0xe4, 0xb5, 0xda, - 0x86, 0x6d, 0x19, 0xab, 0xa8, 0xa1, 0x4e, 0x84, 0x11, 0xab, 0xa8, 0x21, 0x1d, 0x02, 0x30, 0x68, - 0x5d, 0x9d, 0xe8, 0xcd, 0x83, 0x73, 0x1b, 0x1c, 0x4c, 0xac, 0xf2, 0xd7, 0x52, 0x06, 0xa3, 0x2e, - 0x5b, 0xe1, 0xf7, 0xd7, 0xe9, 0x8c, 0xef, 0xc2, 0x0f, 0xe1, 0x7d, 0xcb, 0x01, 0xa4, 0x79, 0x70, - 0x8c, 0x65, 0xb8, 0x6e, 0x9b, 0x88, 0x7a, 0xb7, 0x1c, 0x03, 0x3b, 0x77, 0x2c, 0x52, 0x45, 0xe6, - 0x3a, 0x35, 0x32, 0x74, 0xd5, 0x57, 0xe1, 0x4c, 0x4f, 0x8f, 0xe7, 0x7c, 0x2d, 0x00, 0xeb, 0xd4, - 0xd0, 0x28, 0x72, 0x4c, 0x2d, 0x72, 0x9f, 0x9c, 0xfb, 0xd9, 0x4c, 0xdc, 0xd7, 0xa9, 0x71, 0x03, - 0x39, 0x66, 0x73, 0x44, 0x05, 0x2a, 0x0e, 0xd4, 0x5b, 0xd6, 0x0b, 0x3f, 0x1c, 0x06, 0xbb, 0x19, - 0x21, 0xb8, 0x25, 0x80, 0x43, 0x69, 0x96, 0x0f, 0x5e, 0xce, 0x94, 0xb1, 0x8b, 0xcf, 0x14, 0x8b, - 0xdb, 0x40, 0x08, 0x4a, 0x22, 0x2d, 0x7f, 0xfe, 0xe2, 0xb7, 0xaf, 0x87, 0x17, 0xe0, 0x7c, 0xef, - 0x0f, 0x85, 0xa8, 0xb1, 0xb8, 0xa7, 0x54, 0x1e, 0x86, 0x6f, 0xe3, 0x33, 0xf8, 0x42, 0xe0, 0x1d, - 0x92, 0x34, 0x8f, 0x70, 0xa1, 0x7f, 0x86, 0x09, 0x53, 0x2a, 0x5e, 0x1e, 0x1c, 0x80, 0x2b, 0x3c, - 0xcf, 0x14, 0x9e, 0x81, 0x73, 0x7d, 0x28, 0x0c, 0xec, 0x2a, 0x7c, 0x34, 0x0c, 0x26, 0x3b, 0x78, - 0x50, 0x0a, 0xaf, 0x0e, 0xc8, 0x2c, 0xd5, 0xee, 0x8a, 0xd7, 0x76, 0x08, 0x8d, 0x8b, 0x7e, 0x9f, - 0x89, 0x2e, 0xc1, 0xcb, 0xfd, 0x8a, 0xf6, 0xbf, 0x3a, 0x88, 0xa7, 0x45, 0x4e, 0x12, 0xfe, 0x23, - 0x80, 0x23, 0xe9, 0x96, 0x96, 0xc2, 0xd5, 0x81, 0x49, 0xb7, 0x7b, 0x67, 0xf1, 0xea, 0xce, 0x80, - 0xf1, 0x02, 0x5c, 0x61, 0x05, 0x28, 0xc2, 0x85, 0x01, 0x0a, 0x80, 0xdd, 0x98, 0xfe, 0x3f, 0x43, - 0xd7, 0x94, 0xea, 0x3f, 0xe1, 0x4a, 0x76, 0xd6, 0xdd, 0x9c, 0xb4, 0x78, 0x65, 0xdb, 0x38, 0x5c, - 0x78, 0x91, 0x09, 0xbf, 0x08, 0xcf, 0x67, 0xf8, 0xf2, 0x0f, 0x81, 0xb4, 0xc4, 0xcd, 0x92, 0x22, - 0x39, 0xee, 0x4b, 0x07, 0x92, 0x9c, 0xe2, 0xb0, 0x07, 0x92, 0x9c, 0x66, 0x90, 0x07, 0x93, 0x9c, - 0xb8, 0x94, 0xe1, 0x8f, 0x02, 0xbf, 0xf7, 0x12, 0xde, 0x18, 0x5e, 0xca, 0x4e, 0x31, 0xcd, 0x72, - 0x8b, 0x0b, 0x03, 0xc7, 0x73, 0x69, 0xe7, 0x98, 0xb4, 0x02, 0x9c, 0xed, 0x2d, 0xcd, 0xe3, 0x00, - 0xc1, 0xef, 0x06, 0xf0, 0xdb, 0x61, 0x70, 0x22, 0x83, 0xd9, 0x85, 0xd7, 0xb3, 0x53, 0xcc, 0x64, - 0xb2, 0xc5, 0xb5, 0x9d, 0x03, 0xe4, 0x45, 0x58, 0x65, 0x45, 0x58, 0x86, 0x8b, 0xbd, 0x8b, 0x40, - 0x22, 0xc4, 0x66, 0x4f, 0x13, 0x86, 0xa9, 0x05, 0xe6, 0x1d, 0xfe, 0xd1, 0x66, 0xce, 0x93, 0x9e, - 0x93, 0xc2, 0x3e, 0x6e, 0xd5, 0x0e, 0x5f, 0x00, 0x62, 0x69, 0x3b, 0x10, 0x5c, 0x75, 0x89, 0xa9, - 0x7e, 0x0f, 0x5e, 0xe8, 0xad, 0x3a, 0xf4, 0xfe, 0x5a, 0xeb, 0x05, 0xf6, 0xcd, 0x30, 0xff, 0x11, - 0x25, 0x83, 0xd9, 0x86, 0x37, 0xb3, 0x93, 0xce, 0xfe, 0x29, 0x20, 0xde, 0xda, 0x61, 0x54, 0x5e, - 0x9d, 0x8b, 0xac, 0x3a, 0x67, 0xe1, 0x99, 0xbe, 0xe7, 0xbb, 0x65, 0xc2, 0xef, 0x05, 0x30, 0x11, - 0xf3, 0xb3, 0xf0, 0xdd, 0x3e, 0x5e, 0x57, 0xdc, 0x17, 0x8b, 0xe7, 0xfa, 0x0f, 0xe4, 0xfc, 0x67, - 0x19, 0xff, 0x53, 0x70, 0x26, 0xc3, 0xdb, 0x0d, 0x48, 0xfe, 0x2d, 0xf0, 0x8f, 0xfb, 0x34, 0x8b, - 0x0b, 0x97, 0xb3, 0x33, 0xe9, 0x62, 0xb1, 0xc5, 0x95, 0xed, 0xc2, 0xf4, 0x7f, 0x64, 0x31, 0xc3, - 0xd1, 0x6a, 0x4d, 0x20, 0xad, 0x4e, 0x8d, 0x98, 0xb9, 0x2c, 0x7d, 0xf8, 0x6c, 0x2b, 0x27, 0x3c, - 0xdf, 0xca, 0x09, 0xbf, 0x6e, 0xe5, 0x84, 0x27, 0xaf, 0x72, 0x43, 0xcf, 0x5f, 0xe5, 0x86, 0x7e, - 0x7e, 0x95, 0x1b, 0xfa, 0x68, 0xbe, 0x62, 0x79, 0x9b, 0xb5, 0x0d, 0xd9, 0xc0, 0x55, 0xc5, 0xc0, - 0xb4, 0x8a, 0x69, 0x2c, 0xdf, 0x3b, 0x51, 0xbe, 0xfa, 0x59, 0xe5, 0x41, 0xcb, 0xb0, 0x6c, 0xb8, - 0x88, 0x6e, 0x8c, 0xb2, 0xdf, 0x1c, 0xce, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x7c, 0xde, - 0xed, 0x25, 0x17, 0x00, 0x00, +func (m *QueryConsumerValidatorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConsumerValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerValidatorsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryConsumerValidatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerValidatorsRequest.Merge(m, src) +} +func (m *QueryConsumerValidatorsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryConsumerValidatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerValidatorsRequest.DiscardUnknown(m) } -// 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 +var xxx_messageInfo_QueryConsumerValidatorsRequest proto.InternalMessageInfo -// 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 { - // ConsumerGenesis queries the genesis state needed to start a consumer chain - // whose proposal has been accepted - QueryConsumerGenesis(ctx context.Context, in *QueryConsumerGenesisRequest, opts ...grpc.CallOption) (*QueryConsumerGenesisResponse, error) - // ConsumerChains queries active consumer chains supported by the provider - // chain - QueryConsumerChains(ctx context.Context, in *QueryConsumerChainsRequest, opts ...grpc.CallOption) (*QueryConsumerChainsResponse, error) - // QueryConsumerChainStarts queries consumer chain start proposals. - QueryConsumerChainStarts(ctx context.Context, in *QueryConsumerChainStartProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStartProposalsResponse, error) - // QueryConsumerChainStops queries consumer chain stop proposals. - QueryConsumerChainStops(ctx context.Context, in *QueryConsumerChainStopProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStopProposalsResponse, error) - // QueryValidatorConsumerAddr queries the address - // assigned by a validator for a consumer chain. - QueryValidatorConsumerAddr(ctx context.Context, in *QueryValidatorConsumerAddrRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerAddrResponse, error) - // QueryProviderAddr returns the provider chain validator - // given a consumer chain validator address - QueryValidatorProviderAddr(ctx context.Context, in *QueryValidatorProviderAddrRequest, opts ...grpc.CallOption) (*QueryValidatorProviderAddrResponse, error) - // QueryThrottleState returns the main on-chain state relevant to currently - // throttled slash packets - QueryThrottleState(ctx context.Context, in *QueryThrottleStateRequest, opts ...grpc.CallOption) (*QueryThrottleStateResponse, error) - // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward - // denoms that are registered - QueryRegisteredConsumerRewardDenoms(ctx context.Context, in *QueryRegisteredConsumerRewardDenomsRequest, opts ...grpc.CallOption) (*QueryRegisteredConsumerRewardDenomsResponse, error) - // QueryProposedConsumerChainIDs returns the chain IDs of the proposed consumer chain addition proposals - // that are still in the voting period - QueryProposedConsumerChainIDs(ctx context.Context, in *QueryProposedChainIDsRequest, opts ...grpc.CallOption) (*QueryProposedChainIDsResponse, error) - // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address - // between provider and consumer chain - QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, in *QueryAllPairsValConAddrByConsumerChainIDRequest, opts ...grpc.CallOption) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) - // QueryParams returns all current values of provider parameters - QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID - QueryOldestUnconfirmedVsc(ctx context.Context, in *QueryOldestUnconfirmedVscRequest, opts ...grpc.CallOption) (*QueryOldestUnconfirmedVscResponse, error) +func (m *QueryConsumerValidatorsRequest) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" } -type queryClient struct { - cc grpc1.ClientConn +type QueryConsumerValidatorsValidator struct { + // The consensus address of the validator on the provider chain + ProviderAddress string `protobuf:"bytes,1,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty" yaml:"address"` + // The consumer public key of the validator used on the consumer chain + ConsumerKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` + // The power of the validator used on the consumer chain + Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` } -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} +func (m *QueryConsumerValidatorsValidator) Reset() { *m = QueryConsumerValidatorsValidator{} } +func (m *QueryConsumerValidatorsValidator) String() string { return proto.CompactTextString(m) } +func (*QueryConsumerValidatorsValidator) ProtoMessage() {} +func (*QueryConsumerValidatorsValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{28} } - -func (c *queryClient) QueryConsumerGenesis(ctx context.Context, in *QueryConsumerGenesisRequest, opts ...grpc.CallOption) (*QueryConsumerGenesisResponse, error) { - out := new(QueryConsumerGenesisResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerGenesis", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryConsumerValidatorsValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConsumerValidatorsValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerValidatorsValidator.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 out, nil +} +func (m *QueryConsumerValidatorsValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerValidatorsValidator.Merge(m, src) +} +func (m *QueryConsumerValidatorsValidator) XXX_Size() int { + return m.Size() +} +func (m *QueryConsumerValidatorsValidator) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerValidatorsValidator.DiscardUnknown(m) } -func (c *queryClient) QueryConsumerChains(ctx context.Context, in *QueryConsumerChainsRequest, opts ...grpc.CallOption) (*QueryConsumerChainsResponse, error) { - out := new(QueryConsumerChainsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChains", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryConsumerValidatorsValidator proto.InternalMessageInfo + +func (m *QueryConsumerValidatorsValidator) GetProviderAddress() string { + if m != nil { + return m.ProviderAddress } - return out, nil + return "" } -func (c *queryClient) QueryConsumerChainStarts(ctx context.Context, in *QueryConsumerChainStartProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStartProposalsResponse, error) { - out := new(QueryConsumerChainStartProposalsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStarts", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryConsumerValidatorsValidator) GetConsumerKey() *crypto.PublicKey { + if m != nil { + return m.ConsumerKey } - return out, nil + return nil } -func (c *queryClient) QueryConsumerChainStops(ctx context.Context, in *QueryConsumerChainStopProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStopProposalsResponse, error) { - out := new(QueryConsumerChainStopProposalsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStops", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryConsumerValidatorsValidator) GetPower() int64 { + if m != nil { + return m.Power } - return out, nil + return 0 } -func (c *queryClient) QueryValidatorConsumerAddr(ctx context.Context, in *QueryValidatorConsumerAddrRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerAddrResponse, error) { - out := new(QueryValidatorConsumerAddrResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryValidatorConsumerAddr", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +type QueryConsumerValidatorsResponse struct { + Validators []*QueryConsumerValidatorsValidator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` } -func (c *queryClient) QueryValidatorProviderAddr(ctx context.Context, in *QueryValidatorProviderAddrRequest, opts ...grpc.CallOption) (*QueryValidatorProviderAddrResponse, error) { - out := new(QueryValidatorProviderAddrResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryValidatorProviderAddr", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryConsumerValidatorsResponse) Reset() { *m = QueryConsumerValidatorsResponse{} } +func (m *QueryConsumerValidatorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryConsumerValidatorsResponse) ProtoMessage() {} +func (*QueryConsumerValidatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{29} +} +func (m *QueryConsumerValidatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConsumerValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerValidatorsResponse.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 out, nil +} +func (m *QueryConsumerValidatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerValidatorsResponse.Merge(m, src) +} +func (m *QueryConsumerValidatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryConsumerValidatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerValidatorsResponse.DiscardUnknown(m) } -func (c *queryClient) QueryThrottleState(ctx context.Context, in *QueryThrottleStateRequest, opts ...grpc.CallOption) (*QueryThrottleStateResponse, error) { - out := new(QueryThrottleStateResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryThrottleState", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryConsumerValidatorsResponse proto.InternalMessageInfo + +func (m *QueryConsumerValidatorsResponse) GetValidators() []*QueryConsumerValidatorsValidator { + if m != nil { + return m.Validators } - return out, nil + return nil } -func (c *queryClient) QueryRegisteredConsumerRewardDenoms(ctx context.Context, in *QueryRegisteredConsumerRewardDenomsRequest, opts ...grpc.CallOption) (*QueryRegisteredConsumerRewardDenomsResponse, error) { - out := new(QueryRegisteredConsumerRewardDenomsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryRegisteredConsumerRewardDenoms", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +type QueryConsumerChainsValidatorHasToValidateRequest struct { + // The consensus address of the validator on the provider chain + ProviderAddress string `protobuf:"bytes,1,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty" yaml:"address"` } -func (c *queryClient) QueryProposedConsumerChainIDs(ctx context.Context, in *QueryProposedChainIDsRequest, opts ...grpc.CallOption) (*QueryProposedChainIDsResponse, error) { - out := new(QueryProposedChainIDsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryProposedConsumerChainIDs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryConsumerChainsValidatorHasToValidateRequest) Reset() { + *m = QueryConsumerChainsValidatorHasToValidateRequest{} } - -func (c *queryClient) QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, in *QueryAllPairsValConAddrByConsumerChainIDRequest, opts ...grpc.CallOption) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) { - out := new(QueryAllPairsValConAddrByConsumerChainIDResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryAllPairsValConAddrByConsumerChainID", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryConsumerChainsValidatorHasToValidateRequest) String() string { + return proto.CompactTextString(m) } - -func (c *queryClient) QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryParams", in, out, opts...) - if err != nil { - return nil, err +func (*QueryConsumerChainsValidatorHasToValidateRequest) ProtoMessage() {} +func (*QueryConsumerChainsValidatorHasToValidateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{30} +} +func (m *QueryConsumerChainsValidatorHasToValidateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConsumerChainsValidatorHasToValidateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateRequest.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 out, nil +} +func (m *QueryConsumerChainsValidatorHasToValidateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateRequest.Merge(m, src) +} +func (m *QueryConsumerChainsValidatorHasToValidateRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryConsumerChainsValidatorHasToValidateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateRequest.DiscardUnknown(m) } -func (c *queryClient) QueryOldestUnconfirmedVsc(ctx context.Context, in *QueryOldestUnconfirmedVscRequest, opts ...grpc.CallOption) (*QueryOldestUnconfirmedVscResponse, error) { - out := new(QueryOldestUnconfirmedVscResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryOldestUnconfirmedVsc", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateRequest proto.InternalMessageInfo + +func (m *QueryConsumerChainsValidatorHasToValidateRequest) GetProviderAddress() string { + if m != nil { + return m.ProviderAddress } - return out, nil + return "" } -// QueryServer is the server API for Query service. -type QueryServer interface { - // ConsumerGenesis queries the genesis state needed to start a consumer chain - // whose proposal has been accepted - QueryConsumerGenesis(context.Context, *QueryConsumerGenesisRequest) (*QueryConsumerGenesisResponse, error) - // ConsumerChains queries active consumer chains supported by the provider - // chain - QueryConsumerChains(context.Context, *QueryConsumerChainsRequest) (*QueryConsumerChainsResponse, error) - // QueryConsumerChainStarts queries consumer chain start proposals. - QueryConsumerChainStarts(context.Context, *QueryConsumerChainStartProposalsRequest) (*QueryConsumerChainStartProposalsResponse, error) - // QueryConsumerChainStops queries consumer chain stop proposals. - QueryConsumerChainStops(context.Context, *QueryConsumerChainStopProposalsRequest) (*QueryConsumerChainStopProposalsResponse, error) - // QueryValidatorConsumerAddr queries the address - // assigned by a validator for a consumer chain. - QueryValidatorConsumerAddr(context.Context, *QueryValidatorConsumerAddrRequest) (*QueryValidatorConsumerAddrResponse, error) - // QueryProviderAddr returns the provider chain validator - // given a consumer chain validator address - QueryValidatorProviderAddr(context.Context, *QueryValidatorProviderAddrRequest) (*QueryValidatorProviderAddrResponse, error) - // QueryThrottleState returns the main on-chain state relevant to currently - // throttled slash packets - QueryThrottleState(context.Context, *QueryThrottleStateRequest) (*QueryThrottleStateResponse, error) - // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward - // denoms that are registered - QueryRegisteredConsumerRewardDenoms(context.Context, *QueryRegisteredConsumerRewardDenomsRequest) (*QueryRegisteredConsumerRewardDenomsResponse, error) - // QueryProposedConsumerChainIDs returns the chain IDs of the proposed consumer chain addition proposals - // that are still in the voting period - QueryProposedConsumerChainIDs(context.Context, *QueryProposedChainIDsRequest) (*QueryProposedChainIDsResponse, error) - // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address - // between provider and consumer chain - QueryAllPairsValConAddrByConsumerChainID(context.Context, *QueryAllPairsValConAddrByConsumerChainIDRequest) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) - // QueryParams returns all current values of provider parameters - QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID - QueryOldestUnconfirmedVsc(context.Context, *QueryOldestUnconfirmedVscRequest) (*QueryOldestUnconfirmedVscResponse, error) +type QueryConsumerChainsValidatorHasToValidateResponse struct { + ConsumerChainIds []string `protobuf:"bytes,1,rep,name=consumer_chain_ids,json=consumerChainIds,proto3" json:"consumer_chain_ids,omitempty"` } -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { +func (m *QueryConsumerChainsValidatorHasToValidateResponse) Reset() { + *m = QueryConsumerChainsValidatorHasToValidateResponse{} } - -func (*UnimplementedQueryServer) QueryConsumerGenesis(ctx context.Context, req *QueryConsumerGenesisRequest) (*QueryConsumerGenesisResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerGenesis not implemented") +func (m *QueryConsumerChainsValidatorHasToValidateResponse) String() string { + return proto.CompactTextString(m) } -func (*UnimplementedQueryServer) QueryConsumerChains(ctx context.Context, req *QueryConsumerChainsRequest) (*QueryConsumerChainsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChains not implemented") +func (*QueryConsumerChainsValidatorHasToValidateResponse) ProtoMessage() {} +func (*QueryConsumerChainsValidatorHasToValidateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{31} } -func (*UnimplementedQueryServer) QueryConsumerChainStarts(ctx context.Context, req *QueryConsumerChainStartProposalsRequest) (*QueryConsumerChainStartProposalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChainStarts not implemented") +func (m *QueryConsumerChainsValidatorHasToValidateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) QueryConsumerChainStops(ctx context.Context, req *QueryConsumerChainStopProposalsRequest) (*QueryConsumerChainStopProposalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChainStops not implemented") +func (m *QueryConsumerChainsValidatorHasToValidateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } -func (*UnimplementedQueryServer) QueryValidatorConsumerAddr(ctx context.Context, req *QueryValidatorConsumerAddrRequest) (*QueryValidatorConsumerAddrResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryValidatorConsumerAddr not implemented") +func (m *QueryConsumerChainsValidatorHasToValidateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateResponse.Merge(m, src) } -func (*UnimplementedQueryServer) QueryValidatorProviderAddr(ctx context.Context, req *QueryValidatorProviderAddrRequest) (*QueryValidatorProviderAddrResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryValidatorProviderAddr not implemented") +func (m *QueryConsumerChainsValidatorHasToValidateResponse) XXX_Size() int { + return m.Size() } -func (*UnimplementedQueryServer) QueryThrottleState(ctx context.Context, req *QueryThrottleStateRequest) (*QueryThrottleStateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryThrottleState not implemented") +func (m *QueryConsumerChainsValidatorHasToValidateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateResponse.DiscardUnknown(m) } -func (*UnimplementedQueryServer) QueryRegisteredConsumerRewardDenoms(ctx context.Context, req *QueryRegisteredConsumerRewardDenomsRequest) (*QueryRegisteredConsumerRewardDenomsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryRegisteredConsumerRewardDenoms not implemented") + +var xxx_messageInfo_QueryConsumerChainsValidatorHasToValidateResponse proto.InternalMessageInfo + +func (m *QueryConsumerChainsValidatorHasToValidateResponse) GetConsumerChainIds() []string { + if m != nil { + return m.ConsumerChainIds + } + return nil } -func (*UnimplementedQueryServer) QueryProposedConsumerChainIDs(ctx context.Context, req *QueryProposedChainIDsRequest) (*QueryProposedChainIDsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryProposedConsumerChainIDs not implemented") + +type QueryValidatorConsumerCommissionRateRequest struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // The consensus address of the validator on the provider chain + ProviderAddress string `protobuf:"bytes,2,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty" yaml:"address"` } -func (*UnimplementedQueryServer) QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, req *QueryAllPairsValConAddrByConsumerChainIDRequest) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryAllPairsValConAddrByConsumerChainID not implemented") + +func (m *QueryValidatorConsumerCommissionRateRequest) Reset() { + *m = QueryValidatorConsumerCommissionRateRequest{} } -func (*UnimplementedQueryServer) QueryParams(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryParams not implemented") +func (m *QueryValidatorConsumerCommissionRateRequest) String() string { + return proto.CompactTextString(m) } -func (*UnimplementedQueryServer) QueryOldestUnconfirmedVsc(ctx context.Context, req *QueryOldestUnconfirmedVscRequest) (*QueryOldestUnconfirmedVscResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryOldestUnconfirmedVsc not implemented") +func (*QueryValidatorConsumerCommissionRateRequest) ProtoMessage() {} +func (*QueryValidatorConsumerCommissionRateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{32} } - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) +func (m *QueryValidatorConsumerCommissionRateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func _Query_QueryConsumerGenesis_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConsumerGenesisRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryConsumerGenesis(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerGenesis", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryConsumerGenesis(ctx, req.(*QueryConsumerGenesisRequest)) +func (m *QueryValidatorConsumerCommissionRateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorConsumerCommissionRateRequest.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 interceptor(ctx, in, info, handler) } - -func _Query_QueryConsumerChains_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConsumerChainsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryConsumerChains(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChains", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryConsumerChains(ctx, req.(*QueryConsumerChainsRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryValidatorConsumerCommissionRateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorConsumerCommissionRateRequest.Merge(m, src) } - -func _Query_QueryConsumerChainStarts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConsumerChainStartProposalsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryConsumerChainStarts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStarts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryConsumerChainStarts(ctx, req.(*QueryConsumerChainStartProposalsRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryValidatorConsumerCommissionRateRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorConsumerCommissionRateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorConsumerCommissionRateRequest.DiscardUnknown(m) } -func _Query_QueryConsumerChainStops_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConsumerChainStopProposalsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryConsumerChainStops(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStops", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryConsumerChainStops(ctx, req.(*QueryConsumerChainStopProposalsRequest)) +var xxx_messageInfo_QueryValidatorConsumerCommissionRateRequest proto.InternalMessageInfo + +func (m *QueryValidatorConsumerCommissionRateRequest) GetChainId() string { + if m != nil { + return m.ChainId } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_QueryValidatorConsumerAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorConsumerAddrRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryValidatorConsumerAddr(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryValidatorConsumerAddr", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryValidatorConsumerAddr(ctx, req.(*QueryValidatorConsumerAddrRequest)) +func (m *QueryValidatorConsumerCommissionRateRequest) GetProviderAddress() string { + if m != nil { + return m.ProviderAddress } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_QueryValidatorProviderAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorProviderAddrRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryValidatorProviderAddr(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryValidatorProviderAddr", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryValidatorProviderAddr(ctx, req.(*QueryValidatorProviderAddrRequest)) - } - return interceptor(ctx, in, info, handler) +type QueryValidatorConsumerCommissionRateResponse struct { + // The rate to charge delegators on the consumer chain, as a fraction + Rate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rate"` } -func _Query_QueryThrottleState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryThrottleStateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryThrottleState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryThrottleState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryThrottleState(ctx, req.(*QueryThrottleStateRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryValidatorConsumerCommissionRateResponse) Reset() { + *m = QueryValidatorConsumerCommissionRateResponse{} } - -func _Query_QueryRegisteredConsumerRewardDenoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRegisteredConsumerRewardDenomsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryRegisteredConsumerRewardDenoms(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryRegisteredConsumerRewardDenoms", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryRegisteredConsumerRewardDenoms(ctx, req.(*QueryRegisteredConsumerRewardDenomsRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryValidatorConsumerCommissionRateResponse) String() string { + return proto.CompactTextString(m) } - -func _Query_QueryProposedConsumerChainIDs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposedChainIDsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryProposedConsumerChainIDs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryProposedConsumerChainIDs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryProposedConsumerChainIDs(ctx, req.(*QueryProposedChainIDsRequest)) - } - return interceptor(ctx, in, info, handler) +func (*QueryValidatorConsumerCommissionRateResponse) ProtoMessage() {} +func (*QueryValidatorConsumerCommissionRateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{33} } - -func _Query_QueryAllPairsValConAddrByConsumerChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllPairsValConAddrByConsumerChainIDRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryAllPairsValConAddrByConsumerChainID(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryAllPairsValConAddrByConsumerChainID", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryAllPairsValConAddrByConsumerChainID(ctx, req.(*QueryAllPairsValConAddrByConsumerChainIDRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryValidatorConsumerCommissionRateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func _Query_QueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryParams(ctx, req.(*QueryParamsRequest)) +func (m *QueryValidatorConsumerCommissionRateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorConsumerCommissionRateResponse.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 interceptor(ctx, in, info, handler) } - -func _Query_QueryOldestUnconfirmedVsc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOldestUnconfirmedVscRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryOldestUnconfirmedVsc(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryOldestUnconfirmedVsc", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryOldestUnconfirmedVsc(ctx, req.(*QueryOldestUnconfirmedVscRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryValidatorConsumerCommissionRateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorConsumerCommissionRateResponse.Merge(m, src) } - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "interchain_security.ccv.provider.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "QueryConsumerGenesis", - Handler: _Query_QueryConsumerGenesis_Handler, - }, - { - MethodName: "QueryConsumerChains", - Handler: _Query_QueryConsumerChains_Handler, - }, - { - MethodName: "QueryConsumerChainStarts", - Handler: _Query_QueryConsumerChainStarts_Handler, - }, - { - MethodName: "QueryConsumerChainStops", - Handler: _Query_QueryConsumerChainStops_Handler, - }, - { - MethodName: "QueryValidatorConsumerAddr", - Handler: _Query_QueryValidatorConsumerAddr_Handler, - }, - { - MethodName: "QueryValidatorProviderAddr", - Handler: _Query_QueryValidatorProviderAddr_Handler, - }, - { - MethodName: "QueryThrottleState", - Handler: _Query_QueryThrottleState_Handler, - }, - { - MethodName: "QueryRegisteredConsumerRewardDenoms", - Handler: _Query_QueryRegisteredConsumerRewardDenoms_Handler, - }, - { - MethodName: "QueryProposedConsumerChainIDs", - Handler: _Query_QueryProposedConsumerChainIDs_Handler, - }, - { - MethodName: "QueryAllPairsValConAddrByConsumerChainID", - Handler: _Query_QueryAllPairsValConAddrByConsumerChainID_Handler, - }, - { - MethodName: "QueryParams", - Handler: _Query_QueryParams_Handler, - }, - { - MethodName: "QueryOldestUnconfirmedVsc", - Handler: _Query_QueryOldestUnconfirmedVsc_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "interchain_security/ccv/provider/v1/query.proto", +func (m *QueryValidatorConsumerCommissionRateResponse) XXX_Size() int { + return m.Size() } - -func (m *QueryConsumerGenesisRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (m *QueryValidatorConsumerCommissionRateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorConsumerCommissionRateResponse.DiscardUnknown(m) } -func (m *QueryConsumerGenesisRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +var xxx_messageInfo_QueryValidatorConsumerCommissionRateResponse proto.InternalMessageInfo -func (m *QueryConsumerGenesisRequest) 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] = 0xa - } - return len(dAtA) - i, nil +type QueryOldestUnconfirmedVscRequest struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func (m *QueryConsumerGenesisResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (m *QueryOldestUnconfirmedVscRequest) Reset() { *m = QueryOldestUnconfirmedVscRequest{} } +func (m *QueryOldestUnconfirmedVscRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOldestUnconfirmedVscRequest) ProtoMessage() {} +func (*QueryOldestUnconfirmedVscRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{34} } - -func (m *QueryConsumerGenesisResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryOldestUnconfirmedVscRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (m *QueryConsumerGenesisResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.GenesisState.MarshalToSizedBuffer(dAtA[:i]) +func (m *QueryOldestUnconfirmedVscRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOldestUnconfirmedVscRequest.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 *QueryConsumerChainsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (m *QueryOldestUnconfirmedVscRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOldestUnconfirmedVscRequest.Merge(m, src) } - -func (m *QueryConsumerChainsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryOldestUnconfirmedVscRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOldestUnconfirmedVscRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOldestUnconfirmedVscRequest.DiscardUnknown(m) } -func (m *QueryConsumerChainsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} +var xxx_messageInfo_QueryOldestUnconfirmedVscRequest proto.InternalMessageInfo -func (m *QueryConsumerChainsResponse) 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 *QueryOldestUnconfirmedVscRequest) GetChainId() string { + if m != nil { + return m.ChainId } - return dAtA[:n], nil + return "" } -func (m *QueryConsumerChainsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type QueryOldestUnconfirmedVscResponse struct { + VscSendTimestamp VscSendTimestamp `protobuf:"bytes,1,opt,name=vsc_send_timestamp,json=vscSendTimestamp,proto3" json:"vsc_send_timestamp"` } -func (m *QueryConsumerChainsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Chains) > 0 { - for iNdEx := len(m.Chains) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Chains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (m *QueryOldestUnconfirmedVscResponse) Reset() { *m = QueryOldestUnconfirmedVscResponse{} } +func (m *QueryOldestUnconfirmedVscResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOldestUnconfirmedVscResponse) ProtoMessage() {} +func (*QueryOldestUnconfirmedVscResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{35} +} +func (m *QueryOldestUnconfirmedVscResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOldestUnconfirmedVscResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOldestUnconfirmedVscResponse.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 len(dAtA) - i, nil +} +func (m *QueryOldestUnconfirmedVscResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOldestUnconfirmedVscResponse.Merge(m, src) +} +func (m *QueryOldestUnconfirmedVscResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOldestUnconfirmedVscResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOldestUnconfirmedVscResponse.DiscardUnknown(m) } -func (m *QueryConsumerChainStartProposalsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +var xxx_messageInfo_QueryOldestUnconfirmedVscResponse proto.InternalMessageInfo + +func (m *QueryOldestUnconfirmedVscResponse) GetVscSendTimestamp() VscSendTimestamp { + if m != nil { + return m.VscSendTimestamp } - return dAtA[:n], nil + return VscSendTimestamp{} } -func (m *QueryConsumerChainStartProposalsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func init() { + proto.RegisterType((*QueryConsumerGenesisRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisRequest") + proto.RegisterType((*QueryConsumerGenesisResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisResponse") + proto.RegisterType((*QueryConsumerChainsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsRequest") + proto.RegisterType((*QueryConsumerChainsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsResponse") + proto.RegisterType((*QueryConsumerChainStartProposalsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStartProposalsRequest") + proto.RegisterType((*QueryConsumerChainStartProposalsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStartProposalsResponse") + proto.RegisterType((*QueryConsumerChainStopProposalsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStopProposalsRequest") + proto.RegisterType((*QueryConsumerChainStopProposalsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainStopProposalsResponse") + proto.RegisterType((*Chain)(nil), "interchain_security.ccv.provider.v1.Chain") + proto.RegisterType((*QueryValidatorConsumerAddrRequest)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerAddrRequest") + proto.RegisterType((*QueryValidatorConsumerAddrResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerAddrResponse") + proto.RegisterType((*QueryValidatorProviderAddrRequest)(nil), "interchain_security.ccv.provider.v1.QueryValidatorProviderAddrRequest") + proto.RegisterType((*QueryValidatorProviderAddrResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorProviderAddrResponse") + proto.RegisterType((*QueryThrottleStateRequest)(nil), "interchain_security.ccv.provider.v1.QueryThrottleStateRequest") + proto.RegisterType((*QueryThrottleStateResponse)(nil), "interchain_security.ccv.provider.v1.QueryThrottleStateResponse") + proto.RegisterType((*QueryRegisteredConsumerRewardDenomsRequest)(nil), "interchain_security.ccv.provider.v1.QueryRegisteredConsumerRewardDenomsRequest") + proto.RegisterType((*QueryRegisteredConsumerRewardDenomsResponse)(nil), "interchain_security.ccv.provider.v1.QueryRegisteredConsumerRewardDenomsResponse") + proto.RegisterType((*QueryProposedChainIDsRequest)(nil), "interchain_security.ccv.provider.v1.QueryProposedChainIDsRequest") + proto.RegisterType((*QueryProposedChainIDsResponse)(nil), "interchain_security.ccv.provider.v1.QueryProposedChainIDsResponse") + proto.RegisterType((*ProposedChain)(nil), "interchain_security.ccv.provider.v1.ProposedChain") + proto.RegisterType((*QueryAllPairsValConAddrByConsumerChainIDRequest)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConAddrByConsumerChainIDRequest") + proto.RegisterType((*QueryAllPairsValConAddrByConsumerChainIDResponse)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConAddrByConsumerChainIDResponse") + proto.RegisterType((*PairValConAddrProviderAndConsumer)(nil), "interchain_security.ccv.provider.v1.PairValConAddrProviderAndConsumer") + proto.RegisterType((*QueryParamsRequest)(nil), "interchain_security.ccv.provider.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "interchain_security.ccv.provider.v1.QueryParamsResponse") + proto.RegisterType((*QueryConsumerChainOptedInValidatorsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainOptedInValidatorsRequest") + proto.RegisterType((*QueryConsumerChainOptedInValidatorsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainOptedInValidatorsResponse") + proto.RegisterType((*QueryConsumerValidatorsRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerValidatorsRequest") + proto.RegisterType((*QueryConsumerValidatorsValidator)(nil), "interchain_security.ccv.provider.v1.QueryConsumerValidatorsValidator") + proto.RegisterType((*QueryConsumerValidatorsResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerValidatorsResponse") + proto.RegisterType((*QueryConsumerChainsValidatorHasToValidateRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsValidatorHasToValidateRequest") + proto.RegisterType((*QueryConsumerChainsValidatorHasToValidateResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsValidatorHasToValidateResponse") + proto.RegisterType((*QueryValidatorConsumerCommissionRateRequest)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerCommissionRateRequest") + proto.RegisterType((*QueryValidatorConsumerCommissionRateResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerCommissionRateResponse") + proto.RegisterType((*QueryOldestUnconfirmedVscRequest)(nil), "interchain_security.ccv.provider.v1.QueryOldestUnconfirmedVscRequest") + proto.RegisterType((*QueryOldestUnconfirmedVscResponse)(nil), "interchain_security.ccv.provider.v1.QueryOldestUnconfirmedVscResponse") } -func (m *QueryConsumerChainStartProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func init() { + proto.RegisterFile("interchain_security/ccv/provider/v1/query.proto", fileDescriptor_422512d7b7586cd7) } -func (m *QueryConsumerChainStartProposalsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +var fileDescriptor_422512d7b7586cd7 = []byte{ + // 2045 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcf, 0x6f, 0xdc, 0xc6, + 0xf5, 0x17, 0x57, 0x3f, 0x22, 0x8d, 0xe2, 0x5f, 0x63, 0x7d, 0x13, 0x99, 0x52, 0x76, 0x15, 0xe6, + 0xdb, 0x56, 0x96, 0x9d, 0xa5, 0x24, 0xc3, 0xad, 0x63, 0x57, 0x91, 0xb5, 0x5a, 0xdb, 0xd9, 0xda, + 0x89, 0x15, 0x5a, 0x56, 0x0b, 0xb7, 0x28, 0x3d, 0x26, 0x27, 0x2b, 0xc2, 0x24, 0x87, 0xe2, 0x50, + 0xeb, 0x6c, 0x8d, 0x1c, 0xd2, 0x43, 0x9b, 0x53, 0x11, 0xf4, 0x07, 0xd0, 0x63, 0x2e, 0x05, 0x7a, + 0x29, 0x50, 0x14, 0x45, 0x91, 0x3f, 0x21, 0xb7, 0xa6, 0xcd, 0xa5, 0xe8, 0xc1, 0x2d, 0xec, 0x02, + 0x2d, 0x7a, 0x28, 0x8a, 0xa0, 0x40, 0x4f, 0x05, 0x0a, 0x0e, 0x87, 0xbf, 0x76, 0xb9, 0xbb, 0xe4, + 0xae, 0x7a, 0x11, 0x96, 0x33, 0x6f, 0x3e, 0xf3, 0xde, 0x9b, 0xf7, 0xde, 0xbc, 0xcf, 0x08, 0xc8, + 0x86, 0xed, 0x61, 0x57, 0xdb, 0x47, 0x86, 0xad, 0x52, 0xac, 0x1d, 0xba, 0x86, 0xd7, 0x96, 0x35, + 0xad, 0x25, 0x3b, 0x2e, 0x69, 0x19, 0x3a, 0x76, 0xe5, 0xd6, 0x9a, 0x7c, 0x70, 0x88, 0xdd, 0x76, + 0xd5, 0x71, 0x89, 0x47, 0xe0, 0x2b, 0x19, 0x0b, 0xaa, 0x9a, 0xd6, 0xaa, 0x86, 0x0b, 0xaa, 0xad, + 0x35, 0x71, 0xb1, 0x49, 0x48, 0xd3, 0xc4, 0x32, 0x72, 0x0c, 0x19, 0xd9, 0x36, 0xf1, 0x90, 0x67, + 0x10, 0x9b, 0x06, 0x10, 0xe2, 0x5c, 0x93, 0x34, 0x09, 0xfb, 0x29, 0xfb, 0xbf, 0xf8, 0x68, 0x85, + 0xaf, 0x61, 0x5f, 0x0f, 0x0e, 0xdf, 0x91, 0x3d, 0xc3, 0xc2, 0xd4, 0x43, 0x96, 0xc3, 0x05, 0xd6, + 0xf3, 0xa8, 0x1a, 0x69, 0x11, 0xac, 0x59, 0xed, 0xb5, 0xa6, 0xb5, 0x26, 0xd3, 0x7d, 0xe4, 0x62, + 0x5d, 0xd5, 0x88, 0x4d, 0x0f, 0xad, 0x68, 0xc5, 0x17, 0xfa, 0xac, 0x78, 0x64, 0xb8, 0x98, 0x8b, + 0x2d, 0x7a, 0xd8, 0xd6, 0xb1, 0x6b, 0x19, 0xb6, 0x27, 0x6b, 0x6e, 0xdb, 0xf1, 0x88, 0xfc, 0x10, + 0xb7, 0x43, 0x0b, 0xcf, 0x68, 0x84, 0x5a, 0x84, 0xaa, 0x81, 0x91, 0xc1, 0x07, 0x9f, 0x3a, 0x85, + 0x2c, 0xc3, 0x26, 0x32, 0xfb, 0x1b, 0x0c, 0x49, 0x97, 0xc0, 0xc2, 0xdb, 0xbe, 0x87, 0xb7, 0xb9, + 0x26, 0x37, 0xb0, 0x8d, 0xa9, 0x41, 0x15, 0x7c, 0x70, 0x88, 0xa9, 0x07, 0xcf, 0x80, 0xe9, 0x40, + 0x1d, 0x43, 0x9f, 0x17, 0x96, 0x84, 0xe5, 0x19, 0xe5, 0x39, 0xf6, 0xdd, 0xd0, 0xa5, 0xc7, 0x60, + 0x31, 0x7b, 0x25, 0x75, 0x88, 0x4d, 0x31, 0xfc, 0x26, 0x38, 0xd6, 0x0c, 0x86, 0x54, 0xea, 0x21, + 0x0f, 0xb3, 0xf5, 0xb3, 0xeb, 0xab, 0xd5, 0x5e, 0x87, 0xd8, 0x5a, 0xab, 0x76, 0x60, 0xdd, 0xf1, + 0xd7, 0xd5, 0x26, 0x3e, 0x79, 0x52, 0x19, 0x53, 0x9e, 0x6f, 0x26, 0xc6, 0xa4, 0x45, 0x20, 0xa6, + 0x36, 0xdf, 0xf6, 0xe1, 0x42, 0xad, 0x25, 0xd4, 0x61, 0x54, 0x38, 0xcb, 0x35, 0xab, 0x81, 0x29, + 0xb6, 0x3d, 0x9d, 0x17, 0x96, 0xc6, 0x97, 0x67, 0xd7, 0x57, 0xaa, 0x39, 0xe2, 0xaa, 0xca, 0x40, + 0x14, 0xbe, 0x52, 0x3a, 0x0b, 0xbe, 0xd4, 0xbd, 0xc5, 0x1d, 0x0f, 0xb9, 0xde, 0x8e, 0x4b, 0x1c, + 0x42, 0x91, 0x19, 0x69, 0xf3, 0x81, 0x00, 0x96, 0x07, 0xcb, 0x72, 0xdd, 0xbe, 0x05, 0x66, 0x9c, + 0x70, 0x90, 0x7b, 0xec, 0xf5, 0x7c, 0xea, 0x71, 0xf0, 0x2d, 0x5d, 0x37, 0xfc, 0x80, 0x8f, 0xa1, + 0x63, 0x40, 0x69, 0x19, 0x7c, 0x31, 0x4b, 0x13, 0xe2, 0x74, 0x29, 0xfd, 0x3d, 0x21, 0xdb, 0xc0, + 0x94, 0x68, 0x74, 0xd2, 0x5d, 0x3a, 0x6f, 0x14, 0xd2, 0x59, 0xc1, 0x16, 0x69, 0x21, 0x33, 0x53, + 0xe5, 0x9f, 0x96, 0xc0, 0x24, 0xdb, 0xbb, 0x4f, 0x2c, 0xc2, 0x05, 0x30, 0xa3, 0x99, 0x06, 0xb6, + 0x3d, 0x7f, 0xae, 0xc4, 0xe6, 0xa6, 0x83, 0x81, 0x86, 0x0e, 0x4f, 0x83, 0x49, 0x8f, 0x38, 0xea, + 0x5b, 0xf3, 0xe3, 0x4b, 0xc2, 0xf2, 0x31, 0x65, 0xc2, 0x23, 0xce, 0x5b, 0x70, 0x05, 0x40, 0xcb, + 0xb0, 0x55, 0x87, 0x3c, 0xc2, 0xae, 0x6a, 0xd8, 0x6a, 0x20, 0x31, 0xb1, 0x24, 0x2c, 0x8f, 0x2b, + 0xc7, 0x2d, 0xc3, 0xde, 0xf1, 0x27, 0x1a, 0xf6, 0xae, 0x2f, 0xbb, 0x0a, 0xe6, 0x5a, 0xc8, 0x34, + 0x74, 0xe4, 0x11, 0x97, 0xf2, 0x25, 0x1a, 0x72, 0xe6, 0x27, 0x19, 0x1e, 0x8c, 0xe7, 0xd8, 0xa2, + 0x6d, 0xe4, 0xc0, 0x15, 0x70, 0x2a, 0x1a, 0x55, 0x29, 0xf6, 0x98, 0xf8, 0x14, 0x13, 0x3f, 0x11, + 0x4d, 0xdc, 0xc1, 0x9e, 0x2f, 0xbb, 0x08, 0x66, 0x90, 0x69, 0x92, 0x47, 0xa6, 0x41, 0xbd, 0xf9, + 0xe7, 0x96, 0xc6, 0x97, 0x67, 0x94, 0x78, 0x00, 0x8a, 0x60, 0x5a, 0xc7, 0x76, 0x9b, 0x4d, 0x4e, + 0xb3, 0xc9, 0xe8, 0x5b, 0xfa, 0xbe, 0x00, 0x5e, 0x66, 0x67, 0xb4, 0x17, 0x42, 0x26, 0x82, 0xc0, + 0x1d, 0x9c, 0xc2, 0x70, 0x03, 0x9c, 0x0c, 0x8f, 0x43, 0x45, 0xba, 0xee, 0x62, 0x4a, 0x03, 0xef, + 0xd5, 0xe0, 0xe7, 0x4f, 0x2a, 0xc7, 0xdb, 0xc8, 0x32, 0x2f, 0x4b, 0x7c, 0x42, 0x52, 0x4e, 0x84, + 0xb2, 0x5b, 0xc1, 0xc8, 0xe5, 0xe9, 0x0f, 0x3e, 0xaa, 0x8c, 0xfd, 0xed, 0xa3, 0xca, 0x98, 0x74, + 0x1b, 0x48, 0xfd, 0x14, 0xe1, 0x71, 0x72, 0x16, 0x9c, 0x0c, 0x0b, 0x5e, 0xb4, 0x5d, 0xa0, 0xd1, + 0x09, 0x2d, 0x21, 0xef, 0x6f, 0xd6, 0x6d, 0xda, 0x4e, 0x62, 0xf3, 0x7c, 0xa6, 0x75, 0xed, 0xd5, + 0xc7, 0xb4, 0x8e, 0xfd, 0xfb, 0x99, 0x96, 0x56, 0x24, 0x36, 0xad, 0xcb, 0x93, 0xdc, 0xb4, 0x0e, + 0xaf, 0x49, 0x0b, 0xe0, 0x0c, 0x03, 0xdc, 0xdd, 0x77, 0x89, 0xe7, 0x99, 0x98, 0x15, 0xb4, 0x30, + 0xed, 0x7e, 0x27, 0xf0, 0xc2, 0xd6, 0x31, 0xcb, 0xb7, 0xa9, 0x80, 0x59, 0x6a, 0x22, 0xba, 0xaf, + 0x5a, 0xd8, 0xc3, 0x2e, 0xdb, 0x61, 0x5c, 0x01, 0x6c, 0xe8, 0x4d, 0x7f, 0x04, 0xae, 0x83, 0xff, + 0x4b, 0x08, 0xa8, 0x2c, 0x8e, 0x90, 0xad, 0x61, 0x66, 0xfb, 0xb8, 0x72, 0x3a, 0x16, 0xdd, 0x0a, + 0xa7, 0xe0, 0xb7, 0xc1, 0xbc, 0x8d, 0xdf, 0xf5, 0x54, 0x17, 0x3b, 0x26, 0xb6, 0x0d, 0xba, 0xaf, + 0x6a, 0xc8, 0xd6, 0x7d, 0x63, 0x31, 0x4b, 0x99, 0xd9, 0x75, 0xb1, 0x1a, 0xdc, 0x8f, 0xd5, 0xf0, + 0x7e, 0xac, 0xee, 0x86, 0xf7, 0x63, 0x6d, 0xda, 0xaf, 0xce, 0x1f, 0xfe, 0xa9, 0x22, 0x28, 0x2f, + 0xf8, 0x28, 0x4a, 0x08, 0xb2, 0x1d, 0x62, 0x48, 0xe7, 0xc1, 0x0a, 0x33, 0x49, 0xc1, 0x4d, 0x83, + 0x7a, 0xd8, 0xc5, 0x7a, 0x9c, 0xf7, 0x8f, 0x90, 0xab, 0xd7, 0xb1, 0x4d, 0xac, 0xa8, 0xf0, 0x5c, + 0x03, 0xe7, 0x72, 0x49, 0x73, 0x8f, 0xbc, 0x00, 0xa6, 0x74, 0x36, 0xc2, 0x6a, 0xf9, 0x8c, 0xc2, + 0xbf, 0xa4, 0x32, 0xbf, 0x9d, 0x82, 0x9a, 0x82, 0x75, 0x56, 0x42, 0x1a, 0xf5, 0x68, 0x9b, 0xf7, + 0x05, 0xf0, 0x52, 0x0f, 0x01, 0x8e, 0x7c, 0x1f, 0x1c, 0x77, 0x92, 0x73, 0xe1, 0x6d, 0xb1, 0x9e, + 0xab, 0xb4, 0xa5, 0x60, 0xf9, 0x15, 0xd6, 0x81, 0x27, 0x35, 0xc0, 0xb1, 0x94, 0x18, 0x9c, 0x07, + 0x3c, 0x7e, 0xeb, 0xe9, 0x70, 0xae, 0xc3, 0x32, 0x00, 0x61, 0x49, 0x6c, 0xd4, 0xd9, 0x61, 0x4e, + 0x28, 0x89, 0x11, 0xe9, 0x16, 0x90, 0x99, 0x35, 0x5b, 0xa6, 0xb9, 0x83, 0x0c, 0x97, 0xee, 0x21, + 0x73, 0x9b, 0xd8, 0x7e, 0xc8, 0xd5, 0xd2, 0x15, 0xbc, 0x51, 0xcf, 0x71, 0xb5, 0xff, 0x4c, 0x00, + 0xab, 0xf9, 0xe1, 0xb8, 0xbf, 0x0e, 0xc0, 0x29, 0x07, 0x19, 0xae, 0xda, 0x42, 0xa6, 0xdf, 0xd7, + 0xb0, 0x34, 0xe0, 0x2e, 0xbb, 0x9e, 0xcf, 0x65, 0xc8, 0x70, 0xe3, 0x8d, 0xa2, 0x34, 0xb3, 0xe3, + 0x00, 0x38, 0xee, 0xa4, 0x44, 0xa4, 0x7f, 0x09, 0xe0, 0xe5, 0x81, 0xab, 0xe0, 0xf5, 0x5e, 0xb9, + 0x59, 0x5b, 0xf8, 0xfc, 0x49, 0xe5, 0xc5, 0xa0, 0x14, 0x74, 0x4a, 0x74, 0x97, 0x3b, 0x1f, 0xa7, + 0x47, 0x49, 0x49, 0xe0, 0x74, 0x4a, 0x74, 0xd7, 0x16, 0xb8, 0x09, 0x9e, 0x8f, 0xa4, 0x1e, 0xe2, + 0x36, 0xcf, 0xb1, 0xc5, 0x6a, 0xdc, 0xd5, 0x55, 0x83, 0xae, 0xae, 0xba, 0x73, 0xf8, 0xc0, 0x34, + 0xb4, 0x9b, 0xb8, 0xad, 0xcc, 0x86, 0x2b, 0x6e, 0xe2, 0xb6, 0x34, 0x07, 0x60, 0x10, 0xba, 0xc8, + 0x45, 0x71, 0xe2, 0xdc, 0x07, 0xa7, 0x53, 0xa3, 0xfc, 0x58, 0x1a, 0x60, 0xca, 0x61, 0x23, 0xfc, + 0x66, 0x3e, 0x97, 0xf3, 0x2c, 0xfc, 0x25, 0x3c, 0x6e, 0x39, 0x80, 0x74, 0x83, 0x27, 0x72, 0x2a, + 0x02, 0x6e, 0x3b, 0x1e, 0xd6, 0x1b, 0x76, 0x54, 0x1e, 0xf3, 0xb4, 0x8e, 0x07, 0x3c, 0xc7, 0x07, + 0x01, 0x45, 0xfd, 0xda, 0x4b, 0xc9, 0xfb, 0xb7, 0xe3, 0xa4, 0x70, 0x98, 0xfa, 0x0b, 0x89, 0x8b, + 0x38, 0x7d, 0x74, 0x98, 0x4a, 0x57, 0x40, 0x39, 0xb5, 0x65, 0x21, 0x7d, 0x3f, 0x16, 0xc0, 0x52, + 0x8f, 0xd5, 0xd1, 0xaf, 0xcc, 0xcb, 0x54, 0xc8, 0x7d, 0x99, 0x76, 0x45, 0x45, 0xa9, 0x60, 0x54, + 0xc0, 0x39, 0x30, 0xc9, 0x5a, 0x13, 0x16, 0x4f, 0xe3, 0x4a, 0xf0, 0xe1, 0x37, 0x9f, 0x95, 0x9e, + 0x86, 0x73, 0xff, 0x62, 0x00, 0x62, 0xd7, 0xf1, 0x94, 0xbd, 0x96, 0x2b, 0x4c, 0x06, 0x39, 0x45, + 0x49, 0x00, 0x4b, 0x07, 0xbc, 0xa8, 0xa4, 0xbb, 0xf2, 0x48, 0xf6, 0x0d, 0x44, 0x77, 0x09, 0xff, + 0x0a, 0xef, 0xc3, 0x11, 0x9d, 0x2a, 0x21, 0xb0, 0x56, 0x60, 0x4b, 0xee, 0x8e, 0xf3, 0x00, 0x46, + 0x27, 0x11, 0x46, 0x44, 0x18, 0x63, 0x51, 0x05, 0x08, 0xaa, 0x9f, 0xce, 0x3a, 0x95, 0x73, 0xd9, + 0xbd, 0xcf, 0x36, 0xb1, 0x2c, 0x83, 0x52, 0x83, 0xd8, 0x4a, 0xc2, 0xa2, 0xff, 0x59, 0x3b, 0x26, + 0x7d, 0x07, 0x9c, 0xcf, 0xa7, 0x08, 0xb7, 0xf3, 0x6b, 0x60, 0xc2, 0x0d, 0x79, 0xd9, 0x4c, 0xed, + 0xcb, 0x7e, 0xaa, 0xff, 0xf1, 0x49, 0x65, 0x21, 0x60, 0x8c, 0x54, 0x7f, 0x58, 0x35, 0x88, 0x6c, + 0x21, 0x6f, 0xbf, 0x7a, 0x0b, 0x37, 0x91, 0xd6, 0xae, 0x63, 0xed, 0xf7, 0xbf, 0x7e, 0x15, 0x70, + 0x42, 0x59, 0xc7, 0xda, 0xcf, 0xff, 0xfa, 0xcb, 0x15, 0x41, 0x61, 0x18, 0xd2, 0x06, 0x4f, 0x90, + 0xdb, 0xa6, 0x8e, 0xa9, 0x77, 0xd7, 0xd6, 0x88, 0xfd, 0x8e, 0xe1, 0x5a, 0x58, 0xdf, 0xa3, 0x5a, + 0x8e, 0x04, 0xfb, 0x41, 0xd8, 0xee, 0x65, 0xaf, 0xe7, 0x0a, 0x1b, 0x00, 0xb6, 0xa8, 0xa6, 0x52, + 0x6c, 0xeb, 0x6a, 0x44, 0xd0, 0x79, 0x59, 0xbb, 0x98, 0x2b, 0x5e, 0xf7, 0xa8, 0x76, 0x07, 0xdb, + 0x7a, 0xdc, 0xbd, 0x04, 0x05, 0xee, 0x64, 0xab, 0x63, 0x7c, 0xfd, 0xe3, 0x0a, 0x98, 0x64, 0x0a, + 0xc1, 0xa7, 0x02, 0x98, 0xcb, 0xe2, 0xb9, 0xf0, 0x6a, 0xf1, 0x0c, 0x49, 0x93, 0x6b, 0x71, 0x6b, + 0x04, 0x84, 0xc0, 0x25, 0xd2, 0xb5, 0xef, 0x7e, 0xf6, 0x97, 0x1f, 0x95, 0x36, 0xe1, 0xc6, 0xe0, + 0xb7, 0x94, 0x28, 0xa6, 0x39, 0x91, 0x96, 0x1f, 0x87, 0xa7, 0xf1, 0x1e, 0xfc, 0x4c, 0xe0, 0x97, + 0x47, 0x3a, 0x51, 0xe0, 0x66, 0x71, 0x0d, 0x53, 0x4c, 0x5c, 0xbc, 0x3a, 0x3c, 0x00, 0xb7, 0xf0, + 0x35, 0x66, 0xe1, 0x05, 0xb8, 0x56, 0xc0, 0xc2, 0x80, 0xa3, 0xc3, 0xf7, 0x4b, 0x60, 0xbe, 0x07, + 0xf1, 0xa6, 0xf0, 0xd6, 0x90, 0x9a, 0x65, 0x72, 0x7c, 0xf1, 0xcd, 0x23, 0x42, 0xe3, 0x46, 0xbf, + 0xc1, 0x8c, 0xae, 0xc1, 0xab, 0x45, 0x8d, 0x56, 0xa9, 0x0f, 0xa8, 0x46, 0xf4, 0x19, 0xfe, 0x47, + 0x00, 0x2f, 0x66, 0xf3, 0x78, 0x0a, 0x6f, 0x0e, 0xad, 0x74, 0xf7, 0x83, 0x81, 0x78, 0xeb, 0x68, + 0xc0, 0xb8, 0x03, 0x6e, 0x30, 0x07, 0x6c, 0xc1, 0xcd, 0x21, 0x1c, 0x40, 0x9c, 0x84, 0xfd, 0xff, + 0x0c, 0x09, 0x55, 0x26, 0x35, 0x85, 0xd7, 0xf3, 0x6b, 0xdd, 0x8f, 0x64, 0x8b, 0x37, 0x46, 0xc6, + 0xe1, 0x86, 0x6f, 0x31, 0xc3, 0xaf, 0xc0, 0xd7, 0x72, 0x3c, 0x8e, 0x46, 0x2f, 0x0c, 0xa9, 0xa6, + 0x33, 0xc3, 0xe4, 0x64, 0x3b, 0x34, 0x94, 0xc9, 0x19, 0xe4, 0x7b, 0x28, 0x93, 0xb3, 0xb8, 0xf3, + 0x70, 0x26, 0xa7, 0x2e, 0x4a, 0xf8, 0x5b, 0x81, 0xb7, 0xc4, 0x29, 0xda, 0x0c, 0x5f, 0xcf, 0xaf, + 0x62, 0x16, 0x1b, 0x17, 0x37, 0x87, 0x5e, 0xcf, 0x4d, 0xbb, 0xc4, 0x4c, 0x5b, 0x87, 0xab, 0x83, + 0x4d, 0xf3, 0x38, 0x40, 0xf0, 0x58, 0x0a, 0x7f, 0x52, 0x02, 0xaf, 0xe4, 0xe0, 0xc1, 0xf0, 0x76, + 0x7e, 0x15, 0x73, 0xf1, 0x6f, 0x71, 0xe7, 0xe8, 0x00, 0xb9, 0x13, 0x6e, 0x32, 0x27, 0x5c, 0x83, + 0xdb, 0x83, 0x9d, 0xe0, 0x46, 0x88, 0x71, 0x4c, 0xbb, 0x0c, 0x53, 0x0d, 0x78, 0x3d, 0xfc, 0x7b, + 0x17, 0x6f, 0x4f, 0xd3, 0x51, 0x0a, 0x0b, 0xdc, 0xaa, 0x3d, 0x1e, 0x07, 0xc4, 0xda, 0x28, 0x10, + 0xdc, 0xea, 0x1a, 0xb3, 0xfa, 0xab, 0xf0, 0xf2, 0x60, 0xab, 0xc3, 0x67, 0x01, 0xb5, 0xf3, 0x02, + 0xfb, 0x71, 0x89, 0xbf, 0x1c, 0xe7, 0xe0, 0xe1, 0x70, 0x37, 0xbf, 0xd2, 0xf9, 0x5f, 0x09, 0xc4, + 0xbb, 0x47, 0x8c, 0xca, 0xbd, 0x73, 0x85, 0x79, 0xe7, 0x22, 0xbc, 0x50, 0xb8, 0xbe, 0x1b, 0x3a, + 0xfc, 0x95, 0x00, 0x66, 0x13, 0x54, 0x17, 0x7e, 0xa5, 0xc0, 0x71, 0x25, 0x29, 0xb3, 0x78, 0xa9, + 0xf8, 0x42, 0xae, 0xff, 0x2a, 0xd3, 0x7f, 0x05, 0x2e, 0xe7, 0x38, 0xdd, 0x40, 0xc9, 0x1f, 0x86, + 0x09, 0xdd, 0x9f, 0xf4, 0x16, 0x49, 0xe8, 0x5c, 0x3c, 0xbc, 0x48, 0x42, 0xe7, 0xe3, 0xe3, 0x45, + 0xba, 0x13, 0xe2, 0x83, 0xa8, 0x86, 0xad, 0xc6, 0x3c, 0x30, 0xd9, 0x77, 0xfe, 0xa6, 0x04, 0xce, + 0xe6, 0x26, 0x68, 0xf0, 0xee, 0xb0, 0xcd, 0x64, 0x5f, 0x8e, 0x29, 0xee, 0x1d, 0x35, 0x2c, 0x77, + 0xd3, 0x3d, 0xe6, 0xa6, 0x5d, 0xa8, 0x14, 0xee, 0x5c, 0x55, 0x07, 0xbb, 0xb1, 0xc7, 0xe4, 0xc7, + 0x9d, 0xac, 0xf0, 0x3d, 0xf8, 0x8b, 0x12, 0xf8, 0xff, 0x3c, 0x64, 0x0f, 0xee, 0x8c, 0xd0, 0x98, + 0x64, 0x12, 0x58, 0xf1, 0xed, 0x23, 0x44, 0xe4, 0x9e, 0xba, 0xcf, 0x3c, 0x75, 0x0f, 0x7e, 0xa3, + 0x88, 0xa7, 0x22, 0x28, 0xd5, 0x67, 0xa0, 0x89, 0xa8, 0xca, 0xf2, 0xd7, 0xbf, 0x05, 0xfe, 0xea, + 0x9e, 0x45, 0x30, 0x61, 0x81, 0xc7, 0x8e, 0x3e, 0x04, 0x57, 0xbc, 0x3e, 0x2a, 0x4c, 0xf1, 0x0b, + 0x93, 0x30, 0x1c, 0xf5, 0x30, 0x06, 0x52, 0x5b, 0x54, 0x4b, 0xa6, 0xd8, 0x3f, 0x3a, 0x09, 0x40, + 0xa2, 0xd6, 0x6c, 0x8f, 0xf2, 0xc8, 0x13, 0x5a, 0x5d, 0x1f, 0x0d, 0x64, 0x04, 0xc6, 0x93, 0x59, + 0x53, 0x6a, 0x5f, 0xff, 0xe4, 0x69, 0x59, 0xf8, 0xf4, 0x69, 0x59, 0xf8, 0xf3, 0xd3, 0xb2, 0xf0, + 0xe1, 0xb3, 0xf2, 0xd8, 0xa7, 0xcf, 0xca, 0x63, 0x7f, 0x78, 0x56, 0x1e, 0xbb, 0xb7, 0xd1, 0x34, + 0xbc, 0xfd, 0xc3, 0x07, 0x55, 0x8d, 0x58, 0xfc, 0xff, 0xe2, 0x89, 0xcd, 0x5e, 0x8d, 0x36, 0x6b, + 0x5d, 0x94, 0xdf, 0xed, 0xe8, 0xcd, 0xda, 0x0e, 0xa6, 0x0f, 0xa6, 0xd8, 0x7f, 0x3f, 0x2e, 0xfc, + 0x37, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x73, 0x8b, 0xa7, 0xb7, 0x20, 0x00, 0x00, } -func (m *QueryConsumerChainStartProposalsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// 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 { + // ConsumerGenesis queries the genesis state needed to start a consumer chain + // whose proposal has been accepted + QueryConsumerGenesis(ctx context.Context, in *QueryConsumerGenesisRequest, opts ...grpc.CallOption) (*QueryConsumerGenesisResponse, error) + // ConsumerChains queries active consumer chains supported by the provider + // chain + QueryConsumerChains(ctx context.Context, in *QueryConsumerChainsRequest, opts ...grpc.CallOption) (*QueryConsumerChainsResponse, error) + // QueryConsumerChainStarts queries consumer chain start proposals. + QueryConsumerChainStarts(ctx context.Context, in *QueryConsumerChainStartProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStartProposalsResponse, error) + // QueryConsumerChainStops queries consumer chain stop proposals. + QueryConsumerChainStops(ctx context.Context, in *QueryConsumerChainStopProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStopProposalsResponse, error) + // QueryValidatorConsumerAddr queries the address + // assigned by a validator for a consumer chain. + QueryValidatorConsumerAddr(ctx context.Context, in *QueryValidatorConsumerAddrRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerAddrResponse, error) + // QueryProviderAddr returns the provider chain validator + // given a consumer chain validator address + QueryValidatorProviderAddr(ctx context.Context, in *QueryValidatorProviderAddrRequest, opts ...grpc.CallOption) (*QueryValidatorProviderAddrResponse, error) + // QueryThrottleState returns the main on-chain state relevant to currently + // throttled slash packets + QueryThrottleState(ctx context.Context, in *QueryThrottleStateRequest, opts ...grpc.CallOption) (*QueryThrottleStateResponse, error) + // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward + // denoms that are registered + QueryRegisteredConsumerRewardDenoms(ctx context.Context, in *QueryRegisteredConsumerRewardDenomsRequest, opts ...grpc.CallOption) (*QueryRegisteredConsumerRewardDenomsResponse, error) + // QueryProposedConsumerChainIDs returns the chain IDs of the proposed consumer chain addition proposals + // that are still in the voting period + QueryProposedConsumerChainIDs(ctx context.Context, in *QueryProposedChainIDsRequest, opts ...grpc.CallOption) (*QueryProposedChainIDsResponse, error) + // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address + // between provider and consumer chain + QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, in *QueryAllPairsValConAddrByConsumerChainIDRequest, opts ...grpc.CallOption) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) + // QueryParams returns all current values of provider parameters + QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // QueryConsumerChainOptedInValidators returns a list of validators consensus addresses + // that opted-in to the given consumer chain + QueryConsumerChainOptedInValidators(ctx context.Context, in *QueryConsumerChainOptedInValidatorsRequest, opts ...grpc.CallOption) (*QueryConsumerChainOptedInValidatorsResponse, error) + // QueryConsumerChainsValidatorHasToValidate returns a list of consumer chains + // that a given validator must validate + QueryConsumerChainsValidatorHasToValidate(ctx context.Context, in *QueryConsumerChainsValidatorHasToValidateRequest, opts ...grpc.CallOption) (*QueryConsumerChainsValidatorHasToValidateResponse, error) + // QueryValidatorConsumerCommissionRate returns the commission rate a given + // validator charges on a given consumer chain + QueryValidatorConsumerCommissionRate(ctx context.Context, in *QueryValidatorConsumerCommissionRateRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerCommissionRateResponse, error) + // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID + QueryOldestUnconfirmedVsc(ctx context.Context, in *QueryOldestUnconfirmedVscRequest, opts ...grpc.CallOption) (*QueryOldestUnconfirmedVscResponse, error) + // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID + // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment + // because a VSCPacket could be delayed to be delivered on the consumer chain. + QueryConsumerValidators(ctx context.Context, in *QueryConsumerValidatorsRequest, opts ...grpc.CallOption) (*QueryConsumerValidatorsResponse, error) } -func (m *QueryConsumerChainStartProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proposals != nil { - { - size, err := m.Proposals.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 +type queryClient struct { + cc grpc1.ClientConn } -func (m *QueryConsumerChainStopProposalsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) QueryConsumerGenesis(ctx context.Context, in *QueryConsumerGenesisRequest, opts ...grpc.CallOption) (*QueryConsumerGenesisResponse, error) { + out := new(QueryConsumerGenesisResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerGenesis", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryConsumerChainStopProposalsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryConsumerChains(ctx context.Context, in *QueryConsumerChainsRequest, opts ...grpc.CallOption) (*QueryConsumerChainsResponse, error) { + out := new(QueryConsumerChainsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChains", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConsumerChainStopProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (c *queryClient) QueryConsumerChainStarts(ctx context.Context, in *QueryConsumerChainStartProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStartProposalsResponse, error) { + out := new(QueryConsumerChainStartProposalsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStarts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConsumerChainStopProposalsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryConsumerChainStops(ctx context.Context, in *QueryConsumerChainStopProposalsRequest, opts ...grpc.CallOption) (*QueryConsumerChainStopProposalsResponse, error) { + out := new(QueryConsumerChainStopProposalsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStops", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryConsumerChainStopProposalsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryValidatorConsumerAddr(ctx context.Context, in *QueryValidatorConsumerAddrRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerAddrResponse, error) { + out := new(QueryValidatorConsumerAddrResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryValidatorConsumerAddr", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConsumerChainStopProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proposals != nil { - { - size, err := m.Proposals.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 *Chain) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryValidatorProviderAddr(ctx context.Context, in *QueryValidatorProviderAddrRequest, opts ...grpc.CallOption) (*QueryValidatorProviderAddrResponse, error) { + out := new(QueryValidatorProviderAddrResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryValidatorProviderAddr", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *Chain) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ClientId) > 0 { - i -= len(m.ClientId) - copy(dAtA[i:], m.ClientId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) - i-- - dAtA[i] = 0x12 - } - 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] = 0xa +func (c *queryClient) QueryThrottleState(ctx context.Context, in *QueryThrottleStateRequest, opts ...grpc.CallOption) (*QueryThrottleStateResponse, error) { + out := new(QueryThrottleStateResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryThrottleState", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorConsumerAddrRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryRegisteredConsumerRewardDenoms(ctx context.Context, in *QueryRegisteredConsumerRewardDenomsRequest, opts ...grpc.CallOption) (*QueryRegisteredConsumerRewardDenomsResponse, error) { + out := new(QueryRegisteredConsumerRewardDenomsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryRegisteredConsumerRewardDenoms", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryValidatorConsumerAddrRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryValidatorConsumerAddrRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ProviderAddress) > 0 { - i -= len(m.ProviderAddress) - copy(dAtA[i:], m.ProviderAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) - i-- - dAtA[i] = 0x12 - } - 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] = 0xa +func (c *queryClient) QueryProposedConsumerChainIDs(ctx context.Context, in *QueryProposedChainIDsRequest, opts ...grpc.CallOption) (*QueryProposedChainIDsResponse, error) { + out := new(QueryProposedChainIDsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryProposedConsumerChainIDs", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorConsumerAddrResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, in *QueryAllPairsValConAddrByConsumerChainIDRequest, opts ...grpc.CallOption) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) { + out := new(QueryAllPairsValConAddrByConsumerChainIDResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryAllPairsValConAddrByConsumerChainID", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryValidatorConsumerAddrResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryValidatorConsumerAddrResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ConsumerAddress) > 0 { - i -= len(m.ConsumerAddress) - copy(dAtA[i:], m.ConsumerAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) - i-- - dAtA[i] = 0xa +func (c *queryClient) QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryParams", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorProviderAddrRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryConsumerChainOptedInValidators(ctx context.Context, in *QueryConsumerChainOptedInValidatorsRequest, opts ...grpc.CallOption) (*QueryConsumerChainOptedInValidatorsResponse, error) { + out := new(QueryConsumerChainOptedInValidatorsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainOptedInValidators", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryValidatorProviderAddrRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryValidatorProviderAddrRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ConsumerAddress) > 0 { - i -= len(m.ConsumerAddress) - copy(dAtA[i:], m.ConsumerAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) - i-- - dAtA[i] = 0x12 - } - 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] = 0xa +func (c *queryClient) QueryConsumerChainsValidatorHasToValidate(ctx context.Context, in *QueryConsumerChainsValidatorHasToValidateRequest, opts ...grpc.CallOption) (*QueryConsumerChainsValidatorHasToValidateResponse, error) { + out := new(QueryConsumerChainsValidatorHasToValidateResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainsValidatorHasToValidate", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryValidatorProviderAddrResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryValidatorConsumerCommissionRate(ctx context.Context, in *QueryValidatorConsumerCommissionRateRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerCommissionRateResponse, error) { + out := new(QueryValidatorConsumerCommissionRateResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryValidatorConsumerCommissionRate", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryValidatorProviderAddrResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryValidatorProviderAddrResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ProviderAddress) > 0 { - i -= len(m.ProviderAddress) - copy(dAtA[i:], m.ProviderAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) - i-- - dAtA[i] = 0xa +func (c *queryClient) QueryOldestUnconfirmedVsc(ctx context.Context, in *QueryOldestUnconfirmedVscRequest, opts ...grpc.CallOption) (*QueryOldestUnconfirmedVscResponse, error) { + out := new(QueryOldestUnconfirmedVscResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryOldestUnconfirmedVsc", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryThrottleStateRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) QueryConsumerValidators(ctx context.Context, in *QueryConsumerValidatorsRequest, opts ...grpc.CallOption) (*QueryConsumerValidatorsResponse, error) { + out := new(QueryConsumerValidatorsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerValidators", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryThrottleStateRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// QueryServer is the server API for Query service. +type QueryServer interface { + // ConsumerGenesis queries the genesis state needed to start a consumer chain + // whose proposal has been accepted + QueryConsumerGenesis(context.Context, *QueryConsumerGenesisRequest) (*QueryConsumerGenesisResponse, error) + // ConsumerChains queries active consumer chains supported by the provider + // chain + QueryConsumerChains(context.Context, *QueryConsumerChainsRequest) (*QueryConsumerChainsResponse, error) + // QueryConsumerChainStarts queries consumer chain start proposals. + QueryConsumerChainStarts(context.Context, *QueryConsumerChainStartProposalsRequest) (*QueryConsumerChainStartProposalsResponse, error) + // QueryConsumerChainStops queries consumer chain stop proposals. + QueryConsumerChainStops(context.Context, *QueryConsumerChainStopProposalsRequest) (*QueryConsumerChainStopProposalsResponse, error) + // QueryValidatorConsumerAddr queries the address + // assigned by a validator for a consumer chain. + QueryValidatorConsumerAddr(context.Context, *QueryValidatorConsumerAddrRequest) (*QueryValidatorConsumerAddrResponse, error) + // QueryProviderAddr returns the provider chain validator + // given a consumer chain validator address + QueryValidatorProviderAddr(context.Context, *QueryValidatorProviderAddrRequest) (*QueryValidatorProviderAddrResponse, error) + // QueryThrottleState returns the main on-chain state relevant to currently + // throttled slash packets + QueryThrottleState(context.Context, *QueryThrottleStateRequest) (*QueryThrottleStateResponse, error) + // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward + // denoms that are registered + QueryRegisteredConsumerRewardDenoms(context.Context, *QueryRegisteredConsumerRewardDenomsRequest) (*QueryRegisteredConsumerRewardDenomsResponse, error) + // QueryProposedConsumerChainIDs returns the chain IDs of the proposed consumer chain addition proposals + // that are still in the voting period + QueryProposedConsumerChainIDs(context.Context, *QueryProposedChainIDsRequest) (*QueryProposedChainIDsResponse, error) + // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address + // between provider and consumer chain + QueryAllPairsValConAddrByConsumerChainID(context.Context, *QueryAllPairsValConAddrByConsumerChainIDRequest) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) + // QueryParams returns all current values of provider parameters + QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // QueryConsumerChainOptedInValidators returns a list of validators consensus addresses + // that opted-in to the given consumer chain + QueryConsumerChainOptedInValidators(context.Context, *QueryConsumerChainOptedInValidatorsRequest) (*QueryConsumerChainOptedInValidatorsResponse, error) + // QueryConsumerChainsValidatorHasToValidate returns a list of consumer chains + // that a given validator must validate + QueryConsumerChainsValidatorHasToValidate(context.Context, *QueryConsumerChainsValidatorHasToValidateRequest) (*QueryConsumerChainsValidatorHasToValidateResponse, error) + // QueryValidatorConsumerCommissionRate returns the commission rate a given + // validator charges on a given consumer chain + QueryValidatorConsumerCommissionRate(context.Context, *QueryValidatorConsumerCommissionRateRequest) (*QueryValidatorConsumerCommissionRateResponse, error) + // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID + QueryOldestUnconfirmedVsc(context.Context, *QueryOldestUnconfirmedVscRequest) (*QueryOldestUnconfirmedVscResponse, error) + // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID + // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment + // because a VSCPacket could be delayed to be delivered on the consumer chain. + QueryConsumerValidators(context.Context, *QueryConsumerValidatorsRequest) (*QueryConsumerValidatorsResponse, error) } -func (m *QueryThrottleStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { } -func (m *QueryThrottleStateResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) QueryConsumerGenesis(ctx context.Context, req *QueryConsumerGenesisRequest) (*QueryConsumerGenesisResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerGenesis not implemented") } - -func (m *QueryThrottleStateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) QueryConsumerChains(ctx context.Context, req *QueryConsumerChainsRequest) (*QueryConsumerChainsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChains not implemented") } - -func (m *QueryThrottleStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.NextReplenishCandidate, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.NextReplenishCandidate):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintQuery(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x1a - if m.SlashMeterAllowance != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.SlashMeterAllowance)) - i-- - dAtA[i] = 0x10 - } - if m.SlashMeter != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.SlashMeter)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) QueryConsumerChainStarts(ctx context.Context, req *QueryConsumerChainStartProposalsRequest) (*QueryConsumerChainStartProposalsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChainStarts not implemented") } - -func (m *QueryRegisteredConsumerRewardDenomsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) QueryConsumerChainStops(ctx context.Context, req *QueryConsumerChainStopProposalsRequest) (*QueryConsumerChainStopProposalsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChainStops not implemented") } - -func (m *QueryRegisteredConsumerRewardDenomsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) QueryValidatorConsumerAddr(ctx context.Context, req *QueryValidatorConsumerAddrRequest) (*QueryValidatorConsumerAddrResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryValidatorConsumerAddr not implemented") } - -func (m *QueryRegisteredConsumerRewardDenomsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) QueryValidatorProviderAddr(ctx context.Context, req *QueryValidatorProviderAddrRequest) (*QueryValidatorProviderAddrResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryValidatorProviderAddr not implemented") } - -func (m *QueryRegisteredConsumerRewardDenomsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) QueryThrottleState(ctx context.Context, req *QueryThrottleStateRequest) (*QueryThrottleStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryThrottleState not implemented") } - -func (m *QueryRegisteredConsumerRewardDenomsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) QueryRegisteredConsumerRewardDenoms(ctx context.Context, req *QueryRegisteredConsumerRewardDenomsRequest) (*QueryRegisteredConsumerRewardDenomsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryRegisteredConsumerRewardDenoms not implemented") } - -func (m *QueryRegisteredConsumerRewardDenomsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denoms) > 0 { - for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Denoms[iNdEx]) - copy(dAtA[i:], m.Denoms[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denoms[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) QueryProposedConsumerChainIDs(ctx context.Context, req *QueryProposedChainIDsRequest) (*QueryProposedChainIDsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryProposedConsumerChainIDs not implemented") } - -func (m *QueryProposedChainIDsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, req *QueryAllPairsValConAddrByConsumerChainIDRequest) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllPairsValConAddrByConsumerChainID not implemented") } - -func (m *QueryProposedChainIDsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) QueryParams(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryParams not implemented") } - -func (m *QueryProposedChainIDsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) QueryConsumerChainOptedInValidators(ctx context.Context, req *QueryConsumerChainOptedInValidatorsRequest) (*QueryConsumerChainOptedInValidatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChainOptedInValidators not implemented") } - -func (m *QueryProposedChainIDsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) QueryConsumerChainsValidatorHasToValidate(ctx context.Context, req *QueryConsumerChainsValidatorHasToValidateRequest) (*QueryConsumerChainsValidatorHasToValidateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerChainsValidatorHasToValidate not implemented") } - -func (m *QueryProposedChainIDsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) QueryValidatorConsumerCommissionRate(ctx context.Context, req *QueryValidatorConsumerCommissionRateRequest) (*QueryValidatorConsumerCommissionRateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryValidatorConsumerCommissionRate not implemented") +} +func (*UnimplementedQueryServer) QueryOldestUnconfirmedVsc(ctx context.Context, req *QueryOldestUnconfirmedVscRequest) (*QueryOldestUnconfirmedVscResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryOldestUnconfirmedVsc not implemented") +} +func (*UnimplementedQueryServer) QueryConsumerValidators(ctx context.Context, req *QueryConsumerValidatorsRequest) (*QueryConsumerValidatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerValidators not implemented") } -func (m *QueryProposedChainIDsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ProposedChains) > 0 { - for iNdEx := len(m.ProposedChains) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ProposedChains[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 RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) } -func (m *ProposedChain) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_QueryConsumerGenesis_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerGenesisRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).QueryConsumerGenesis(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerGenesis", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerGenesis(ctx, req.(*QueryConsumerGenesisRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *ProposedChain) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_QueryConsumerChains_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerChainsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryConsumerChains(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChains", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerChains(ctx, req.(*QueryConsumerChainsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *ProposedChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalID != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalID)) - i-- - dAtA[i] = 0x10 +func _Query_QueryConsumerChainStarts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerChainStartProposalsRequest) + if err := dec(in); err != nil { + return nil, err } - 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] = 0xa + if interceptor == nil { + return srv.(QueryServer).QueryConsumerChainStarts(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStarts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerChainStarts(ctx, req.(*QueryConsumerChainStartProposalsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_QueryConsumerChainStops_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerChainStopProposalsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).QueryConsumerChainStops(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainStops", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerChainStops(ctx, req.(*QueryConsumerChainStopProposalsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_QueryValidatorConsumerAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorConsumerAddrRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryValidatorConsumerAddr(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryValidatorConsumerAddr", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryValidatorConsumerAddr(ctx, req.(*QueryValidatorConsumerAddrRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) 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] = 0xa +func _Query_QueryValidatorProviderAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorProviderAddrRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).QueryValidatorProviderAddr(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryValidatorProviderAddr", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryValidatorProviderAddr(ctx, req.(*QueryValidatorProviderAddrRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_QueryThrottleState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryThrottleStateRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if interceptor == nil { + return srv.(QueryServer).QueryThrottleState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryThrottleState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryThrottleState(ctx, req.(*QueryThrottleStateRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PairValConAddr) > 0 { - for iNdEx := len(m.PairValConAddr) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PairValConAddr[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func _Query_QueryRegisteredConsumerRewardDenoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRegisteredConsumerRewardDenomsRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).QueryRegisteredConsumerRewardDenoms(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryRegisteredConsumerRewardDenoms", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryRegisteredConsumerRewardDenoms(ctx, req.(*QueryRegisteredConsumerRewardDenomsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *PairValConAddrProviderAndConsumer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_QueryProposedConsumerChainIDs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposedChainIDsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).QueryProposedConsumerChainIDs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryProposedConsumerChainIDs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryProposedConsumerChainIDs(ctx, req.(*QueryProposedChainIDsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *PairValConAddrProviderAndConsumer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_QueryAllPairsValConAddrByConsumerChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllPairsValConAddrByConsumerChainIDRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllPairsValConAddrByConsumerChainID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryAllPairsValConAddrByConsumerChainID", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllPairsValConAddrByConsumerChainID(ctx, req.(*QueryAllPairsValConAddrByConsumerChainIDRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *PairValConAddrProviderAndConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConsumerKey != nil { - { - size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a +func _Query_QueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.ConsumerAddress) > 0 { - i -= len(m.ConsumerAddress) - copy(dAtA[i:], m.ConsumerAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) - i-- - dAtA[i] = 0x12 + if interceptor == nil { + return srv.(QueryServer).QueryParams(ctx, in) } - if len(m.ProviderAddress) > 0 { - i -= len(m.ProviderAddress) - copy(dAtA[i:], m.ProviderAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) - i-- - dAtA[i] = 0xa + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryParams", } - return len(dAtA) - i, nil + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryParams(ctx, req.(*QueryParamsRequest)) + } + 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_QueryConsumerChainOptedInValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerChainOptedInValidatorsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).QueryConsumerChainOptedInValidators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainOptedInValidators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerChainOptedInValidators(ctx, req.(*QueryConsumerChainOptedInValidatorsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_QueryConsumerChainsValidatorHasToValidate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerChainsValidatorHasToValidateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryConsumerChainsValidatorHasToValidate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerChainsValidatorHasToValidate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerChainsValidatorHasToValidate(ctx, req.(*QueryConsumerChainsValidatorHasToValidateRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func _Query_QueryValidatorConsumerCommissionRate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorConsumerCommissionRateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryValidatorConsumerCommissionRate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryValidatorConsumerCommissionRate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryValidatorConsumerCommissionRate(ctx, req.(*QueryValidatorConsumerCommissionRateRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_QueryOldestUnconfirmedVsc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOldestUnconfirmedVscRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).QueryOldestUnconfirmedVsc(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryOldestUnconfirmedVsc", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryOldestUnconfirmedVsc(ctx, req.(*QueryOldestUnconfirmedVscRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_QueryConsumerValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConsumerValidatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryConsumerValidators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryConsumerValidators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryConsumerValidators(ctx, req.(*QueryConsumerValidatorsRequest)) + } + return interceptor(ctx, in, info, handler) } -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 +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "interchain_security.ccv.provider.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "QueryConsumerGenesis", + Handler: _Query_QueryConsumerGenesis_Handler, + }, + { + MethodName: "QueryConsumerChains", + Handler: _Query_QueryConsumerChains_Handler, + }, + { + MethodName: "QueryConsumerChainStarts", + Handler: _Query_QueryConsumerChainStarts_Handler, + }, + { + MethodName: "QueryConsumerChainStops", + Handler: _Query_QueryConsumerChainStops_Handler, + }, + { + MethodName: "QueryValidatorConsumerAddr", + Handler: _Query_QueryValidatorConsumerAddr_Handler, + }, + { + MethodName: "QueryValidatorProviderAddr", + Handler: _Query_QueryValidatorProviderAddr_Handler, + }, + { + MethodName: "QueryThrottleState", + Handler: _Query_QueryThrottleState_Handler, + }, + { + MethodName: "QueryRegisteredConsumerRewardDenoms", + Handler: _Query_QueryRegisteredConsumerRewardDenoms_Handler, + }, + { + MethodName: "QueryProposedConsumerChainIDs", + Handler: _Query_QueryProposedConsumerChainIDs_Handler, + }, + { + MethodName: "QueryAllPairsValConAddrByConsumerChainID", + Handler: _Query_QueryAllPairsValConAddrByConsumerChainID_Handler, + }, + { + MethodName: "QueryParams", + Handler: _Query_QueryParams_Handler, + }, + { + MethodName: "QueryConsumerChainOptedInValidators", + Handler: _Query_QueryConsumerChainOptedInValidators_Handler, + }, + { + MethodName: "QueryConsumerChainsValidatorHasToValidate", + Handler: _Query_QueryConsumerChainsValidatorHasToValidate_Handler, + }, + { + MethodName: "QueryValidatorConsumerCommissionRate", + Handler: _Query_QueryValidatorConsumerCommissionRate_Handler, + }, + { + MethodName: "QueryOldestUnconfirmedVsc", + Handler: _Query_QueryOldestUnconfirmedVsc_Handler, + }, + { + MethodName: "QueryConsumerValidators", + Handler: _Query_QueryConsumerValidators_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "interchain_security/ccv/provider/v1/query.proto", } -func (m *QueryOldestUnconfirmedVscRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryConsumerGenesisRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2697,12 +2608,12 @@ func (m *QueryOldestUnconfirmedVscRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryOldestUnconfirmedVscRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryConsumerGenesisRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryOldestUnconfirmedVscRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryConsumerGenesisRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2717,7 +2628,7 @@ func (m *QueryOldestUnconfirmedVscRequest) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func (m *QueryOldestUnconfirmedVscResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryConsumerGenesisResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2727,18 +2638,18 @@ func (m *QueryOldestUnconfirmedVscResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryOldestUnconfirmedVscResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryConsumerGenesisResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryOldestUnconfirmedVscResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryConsumerGenesisResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.VscSendTimestamp.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.GenesisState.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2750,376 +2661,2695 @@ func (m *QueryOldestUnconfirmedVscResponse) MarshalToSizedBuffer(dAtA []byte) (i 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++ +func (m *QueryConsumerChainsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryConsumerGenesisRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n + +func (m *QueryConsumerChainsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryConsumerGenesisResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryConsumerChainsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.GenesisState.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + return len(dAtA) - i, nil } -func (m *QueryConsumerChainsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryConsumerChainsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryConsumerChainsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryConsumerChainsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if len(m.Chains) > 0 { - for _, e := range m.Chains { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + for iNdEx := len(m.Chains) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Chains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } } - return n + return len(dAtA) - i, nil } -func (m *QueryConsumerChainStartProposalsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryConsumerChainStartProposalsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryConsumerChainStartProposalsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainStartProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *QueryConsumerChainStartProposalsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryConsumerChainStartProposalsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryConsumerChainStartProposalsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainStartProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if m.Proposals != nil { - l = m.Proposals.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.Proposals.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryConsumerChainStopProposalsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryConsumerChainStopProposalsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryConsumerChainStopProposalsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryConsumerChainStopProposalsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainStopProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Proposals != nil { - l = m.Proposals.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *Chain) Size() (n int) { - if m == nil { - return 0 +func (m *QueryConsumerChainStopProposalsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryConsumerChainStopProposalsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainStopProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Proposals != nil { + { + size, err := m.Proposals.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryValidatorConsumerAddrRequest) Size() (n int) { - if m == nil { - return 0 +func (m *Chain) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *Chain) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Denylist) > 0 { + for iNdEx := len(m.Denylist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denylist[iNdEx]) + copy(dAtA[i:], m.Denylist[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denylist[iNdEx]))) + i-- + dAtA[i] = 0x42 + } } - l = len(m.ProviderAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Allowlist) > 0 { + for iNdEx := len(m.Allowlist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Allowlist[iNdEx]) + copy(dAtA[i:], m.Allowlist[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Allowlist[iNdEx]))) + i-- + dAtA[i] = 0x3a + } } - return n -} - -func (m *QueryValidatorConsumerAddrResponse) Size() (n int) { - if m == nil { - return 0 + if m.ValidatorSetCap != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ValidatorSetCap)) + i-- + dAtA[i] = 0x30 } - var l int - _ = l - l = len(m.ConsumerAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.ValidatorsPowerCap != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ValidatorsPowerCap)) + i-- + dAtA[i] = 0x28 } - return n -} - -func (m *QueryValidatorProviderAddrRequest) Size() (n int) { - if m == nil { - return 0 + if m.MinPowerInTop_N != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.MinPowerInTop_N)) + i-- + dAtA[i] = 0x20 } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Top_N != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Top_N)) + i-- + dAtA[i] = 0x18 } - l = len(m.ConsumerAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0x12 } - return n + 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] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryValidatorProviderAddrResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ProviderAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryValidatorConsumerAddrRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryThrottleStateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n +func (m *QueryValidatorConsumerAddrRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryThrottleStateResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryValidatorConsumerAddrRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.SlashMeter != 0 { - n += 1 + sovQuery(uint64(m.SlashMeter)) + if len(m.ProviderAddress) > 0 { + i -= len(m.ProviderAddress) + copy(dAtA[i:], m.ProviderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) + i-- + dAtA[i] = 0x12 } - if m.SlashMeterAllowance != 0 { - n += 1 + sovQuery(uint64(m.SlashMeterAllowance)) + 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] = 0xa } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.NextReplenishCandidate) - n += 1 + l + sovQuery(uint64(l)) - return n + return len(dAtA) - i, nil } -func (m *QueryRegisteredConsumerRewardDenomsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryValidatorConsumerAddrResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryRegisteredConsumerRewardDenomsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Denoms) > 0 { - for _, s := range m.Denoms { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - return n +func (m *QueryValidatorConsumerAddrResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProposedChainIDsRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryValidatorConsumerAddrResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + if len(m.ConsumerAddress) > 0 { + i -= len(m.ConsumerAddress) + copy(dAtA[i:], m.ConsumerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryProposedChainIDsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ProposedChains) > 0 { - for _, e := range m.ProposedChains { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } +func (m *QueryValidatorProviderAddrRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *ProposedChain) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.ProposalID != 0 { - n += 1 + sovQuery(uint64(m.ProposalID)) - } - return n +func (m *QueryValidatorProviderAddrRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryValidatorProviderAddrRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ConsumerAddress) > 0 { + i -= len(m.ConsumerAddress) + copy(dAtA[i:], m.ConsumerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) + i-- + dAtA[i] = 0x12 } - return n + 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] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryValidatorProviderAddrResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryValidatorProviderAddrResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorProviderAddrResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.PairValConAddr) > 0 { - for _, e := range m.PairValConAddr { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if len(m.ProviderAddress) > 0 { + i -= len(m.ProviderAddress) + copy(dAtA[i:], m.ProviderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *PairValConAddrProviderAndConsumer) Size() (n int) { - if m == nil { - return 0 +func (m *QueryThrottleStateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryThrottleStateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryThrottleStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryThrottleStateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryThrottleStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryThrottleStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ProviderAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.NextReplenishCandidate, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.NextReplenishCandidate):]) + if err4 != nil { + return 0, err4 } - l = len(m.ConsumerAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + i -= n4 + i = encodeVarintQuery(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x1a + if m.SlashMeterAllowance != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.SlashMeterAllowance)) + i-- + dAtA[i] = 0x10 } - if m.ConsumerKey != nil { - l = m.ConsumerKey.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.SlashMeter != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.SlashMeter)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryRegisteredConsumerRewardDenomsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryRegisteredConsumerRewardDenomsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRegisteredConsumerRewardDenomsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + if len(m.Denoms) > 0 { + for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denoms[iNdEx]) + copy(dAtA[i:], m.Denoms[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denoms[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryProposedChainIDsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryProposedChainIDsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposedChainIDsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + return len(dAtA) - i, nil } -func (m *QueryOldestUnconfirmedVscRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryProposedChainIDsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryProposedChainIDsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposedChainIDsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ProposedChains) > 0 { + for iNdEx := len(m.ProposedChains) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProposedChains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryOldestUnconfirmedVscResponse) Size() (n int) { - if m == nil { - return 0 +func (m *ProposedChain) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProposedChain) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProposedChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalID != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalID)) + i-- + dAtA[i] = 0x10 + } + 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PairValConAddr) > 0 { + for iNdEx := len(m.PairValConAddr) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PairValConAddr[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 *PairValConAddrProviderAndConsumer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PairValConAddrProviderAndConsumer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PairValConAddrProviderAndConsumer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ConsumerKey != nil { + { + size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.ConsumerAddress) > 0 { + i -= len(m.ConsumerAddress) + copy(dAtA[i:], m.ConsumerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.ProviderAddress) > 0 { + i -= len(m.ProviderAddress) + copy(dAtA[i:], m.ProviderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryConsumerChainOptedInValidatorsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConsumerChainOptedInValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainOptedInValidatorsRequest) 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryConsumerChainOptedInValidatorsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConsumerChainOptedInValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainOptedInValidatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorsProviderAddresses) > 0 { + for iNdEx := len(m.ValidatorsProviderAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ValidatorsProviderAddresses[iNdEx]) + copy(dAtA[i:], m.ValidatorsProviderAddresses[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorsProviderAddresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryConsumerValidatorsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConsumerValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerValidatorsRequest) 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryConsumerValidatorsValidator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConsumerValidatorsValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerValidatorsValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Power != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x18 + } + if m.ConsumerKey != nil { + { + size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ProviderAddress) > 0 { + i -= len(m.ProviderAddress) + copy(dAtA[i:], m.ProviderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryConsumerValidatorsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConsumerValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerValidatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryConsumerChainsValidatorHasToValidateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConsumerChainsValidatorHasToValidateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainsValidatorHasToValidateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProviderAddress) > 0 { + i -= len(m.ProviderAddress) + copy(dAtA[i:], m.ProviderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryConsumerChainsValidatorHasToValidateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConsumerChainsValidatorHasToValidateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConsumerChainsValidatorHasToValidateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConsumerChainIds) > 0 { + for iNdEx := len(m.ConsumerChainIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ConsumerChainIds[iNdEx]) + copy(dAtA[i:], m.ConsumerChainIds[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsumerChainIds[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorConsumerCommissionRateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryValidatorConsumerCommissionRateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorConsumerCommissionRateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProviderAddress) > 0 { + i -= len(m.ProviderAddress) + copy(dAtA[i:], m.ProviderAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProviderAddress))) + i-- + dAtA[i] = 0x12 + } + 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorConsumerCommissionRateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryValidatorConsumerCommissionRateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorConsumerCommissionRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Rate.Size() + i -= size + if _, err := m.Rate.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 *QueryOldestUnconfirmedVscRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOldestUnconfirmedVscRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOldestUnconfirmedVscRequest) 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOldestUnconfirmedVscResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOldestUnconfirmedVscResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOldestUnconfirmedVscResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.VscSendTimestamp.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryConsumerGenesisRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConsumerGenesisResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.GenesisState.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryConsumerChainsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryConsumerChainsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Chains) > 0 { + for _, e := range m.Chains { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryConsumerChainStartProposalsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryConsumerChainStartProposalsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proposals != nil { + l = m.Proposals.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConsumerChainStopProposalsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryConsumerChainStopProposalsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proposals != nil { + l = m.Proposals.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *Chain) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Top_N != 0 { + n += 1 + sovQuery(uint64(m.Top_N)) + } + if m.MinPowerInTop_N != 0 { + n += 1 + sovQuery(uint64(m.MinPowerInTop_N)) + } + if m.ValidatorsPowerCap != 0 { + n += 1 + sovQuery(uint64(m.ValidatorsPowerCap)) + } + if m.ValidatorSetCap != 0 { + n += 1 + sovQuery(uint64(m.ValidatorSetCap)) + } + if len(m.Allowlist) > 0 { + for _, s := range m.Allowlist { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.Denylist) > 0 { + for _, s := range m.Denylist { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryValidatorConsumerAddrRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ProviderAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorConsumerAddrResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsumerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorProviderAddrRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ConsumerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorProviderAddrResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProviderAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryThrottleStateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryThrottleStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SlashMeter != 0 { + n += 1 + sovQuery(uint64(m.SlashMeter)) + } + if m.SlashMeterAllowance != 0 { + n += 1 + sovQuery(uint64(m.SlashMeterAllowance)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.NextReplenishCandidate) + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryRegisteredConsumerRewardDenomsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Denoms) > 0 { + for _, s := range m.Denoms { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryProposedChainIDsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryProposedChainIDsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ProposedChains) > 0 { + for _, e := range m.ProposedChains { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *ProposedChain) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ProposalID != 0 { + n += 1 + sovQuery(uint64(m.ProposalID)) + } + return n +} + +func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PairValConAddr) > 0 { + for _, e := range m.PairValConAddr { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *PairValConAddrProviderAndConsumer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProviderAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ConsumerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ConsumerKey != nil { + l = m.ConsumerKey.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryConsumerChainOptedInValidatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConsumerChainOptedInValidatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ValidatorsProviderAddresses) > 0 { + for _, s := range m.ValidatorsProviderAddresses { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryConsumerValidatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConsumerValidatorsValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProviderAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ConsumerKey != nil { + l = m.ConsumerKey.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Power != 0 { + n += 1 + sovQuery(uint64(m.Power)) + } + return n +} + +func (m *QueryConsumerValidatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Validators) > 0 { + for _, e := range m.Validators { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryConsumerChainsValidatorHasToValidateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProviderAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConsumerChainsValidatorHasToValidateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ConsumerChainIds) > 0 { + for _, s := range m.ConsumerChainIds { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryValidatorConsumerCommissionRateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ProviderAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorConsumerCommissionRateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Rate.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryOldestUnconfirmedVscRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOldestUnconfirmedVscResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.VscSendTimestamp.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryConsumerGenesisRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerGenesisRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerGenesisRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.ChainId = 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 *QueryConsumerGenesisResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerGenesisResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerGenesisResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisState", 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.GenesisState.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 *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerChainsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerChainsRequest: 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 *QueryConsumerChainsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerChainsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chains", 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.Chains = append(m.Chains, &Chain{}) + if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConsumerChainStartProposalsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerChainStartProposalsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerChainStartProposalsRequest: 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 *QueryConsumerChainStartProposalsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerChainStartProposalsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerChainStartProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proposals == nil { + m.Proposals = &ConsumerAdditionProposals{} + } + if err := m.Proposals.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 *QueryConsumerChainStopProposalsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerChainStopProposalsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerChainStopProposalsRequest: 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 *QueryConsumerChainStopProposalsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConsumerChainStopProposalsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConsumerChainStopProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proposals == nil { + m.Proposals = &ConsumerRemovalProposals{} + } + if err := m.Proposals.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 *Chain) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Chain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", 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.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Top_N", wireType) + } + m.Top_N = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Top_N |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinPowerInTop_N", wireType) + } + m.MinPowerInTop_N = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinPowerInTop_N |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsPowerCap", wireType) + } + m.ValidatorsPowerCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorsPowerCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetCap", wireType) + } + m.ValidatorSetCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorSetCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", 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.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denylist", 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.Denylist = append(m.Denylist, 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 *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryValidatorConsumerAddrRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorConsumerAddrRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", 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.ProviderAddress = 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 *QueryValidatorConsumerAddrResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryValidatorConsumerAddrResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorConsumerAddrResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddress", 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.ConsumerAddress = 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 - l = m.VscSendTimestamp.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)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *QueryConsumerGenesisRequest) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3142,10 +5372,10 @@ func (m *QueryConsumerGenesisRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerGenesisRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorProviderAddrRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerGenesisRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryValidatorProviderAddrRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3180,6 +5410,38 @@ func (m *QueryConsumerGenesisRequest) Unmarshal(dAtA []byte) error { } m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddress", 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.ConsumerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3201,7 +5463,7 @@ func (m *QueryConsumerGenesisRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerGenesisResponse) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorProviderAddrResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3224,17 +5486,17 @@ func (m *QueryConsumerGenesisResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerGenesisResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryValidatorProviderAddrResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerGenesisResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryValidatorProviderAddrResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GenesisState", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3244,24 +5506,23 @@ func (m *QueryConsumerGenesisResponse) 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.GenesisState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3284,7 +5545,7 @@ func (m *QueryConsumerGenesisResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryThrottleStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3307,10 +5568,10 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryThrottleStateRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryThrottleStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3334,7 +5595,7 @@ func (m *QueryConsumerChainsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerChainsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryThrottleStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3357,15 +5618,53 @@ func (m *QueryConsumerChainsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryThrottleStateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryThrottleStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SlashMeter", wireType) + } + m.SlashMeter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SlashMeter |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SlashMeterAllowance", wireType) + } + m.SlashMeterAllowance = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SlashMeterAllowance |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chains", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NextReplenishCandidate", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3392,8 +5691,7 @@ func (m *QueryConsumerChainsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Chains = append(m.Chains, &Chain{}) - if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.NextReplenishCandidate, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3418,7 +5716,7 @@ func (m *QueryConsumerChainsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerChainStartProposalsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRegisteredConsumerRewardDenomsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3441,10 +5739,10 @@ func (m *QueryConsumerChainStartProposalsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainStartProposalsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainStartProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3468,7 +5766,7 @@ func (m *QueryConsumerChainStartProposalsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerChainStartProposalsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRegisteredConsumerRewardDenomsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3491,17 +5789,17 @@ func (m *QueryConsumerChainStartProposalsResponse) Unmarshal(dAtA []byte) error fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainStartProposalsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainStartProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3511,27 +5809,23 @@ func (m *QueryConsumerChainStartProposalsResponse) 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 m.Proposals == nil { - m.Proposals = &ConsumerAdditionProposals{} - } - if err := m.Proposals.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -3554,7 +5848,7 @@ func (m *QueryConsumerChainStartProposalsResponse) Unmarshal(dAtA []byte) error } return nil } -func (m *QueryConsumerChainStopProposalsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryProposedChainIDsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3577,10 +5871,10 @@ func (m *QueryConsumerChainStopProposalsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainStopProposalsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryProposedChainIDsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainStopProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryProposedChainIDsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3604,7 +5898,7 @@ func (m *QueryConsumerChainStopProposalsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConsumerChainStopProposalsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryProposedChainIDsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3627,15 +5921,15 @@ func (m *QueryConsumerChainStopProposalsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConsumerChainStopProposalsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryProposedChainIDsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConsumerChainStopProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryProposedChainIDsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProposedChains", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3662,10 +5956,8 @@ func (m *QueryConsumerChainStopProposalsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proposals == nil { - m.Proposals = &ConsumerRemovalProposals{} - } - if err := m.Proposals.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ProposedChains = append(m.ProposedChains, ProposedChain{}) + if err := m.ProposedChains[len(m.ProposedChains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3690,7 +5982,7 @@ func (m *QueryConsumerChainStopProposalsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *Chain) Unmarshal(dAtA []byte) error { +func (m *ProposedChain) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3713,15 +6005,15 @@ func (m *Chain) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Chain: wiretype end group for non-group") + return fmt.Errorf("proto: ProposedChain: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ProposedChain: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: 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 { @@ -3749,13 +6041,13 @@ func (m *Chain) 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 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalID", wireType) } - var stringLen uint64 + m.ProposalID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3765,24 +6057,11 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ProposalID |= 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.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3804,7 +6083,7 @@ func (m *Chain) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3822,52 +6101,20 @@ func (m *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { wire |= uint64(b&0x7F) << shift if b < 0x80 { break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorConsumerAddrRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorConsumerAddrRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 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.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3895,7 +6142,7 @@ func (m *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddress = string(dAtA[iNdEx:postIndex]) + m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3918,7 +6165,7 @@ func (m *QueryValidatorConsumerAddrRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorConsumerAddrResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3941,17 +6188,17 @@ func (m *QueryValidatorConsumerAddrResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorConsumerAddrResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorConsumerAddrResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PairValConAddr", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3961,23 +6208,25 @@ func (m *QueryValidatorConsumerAddrResponse) 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.ConsumerAddress = string(dAtA[iNdEx:postIndex]) + m.PairValConAddr = append(m.PairValConAddr, &PairValConAddrProviderAndConsumer{}) + if err := m.PairValConAddr[len(m.PairValConAddr)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -4000,7 +6249,7 @@ func (m *QueryValidatorConsumerAddrResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { +func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4023,15 +6272,15 @@ func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorProviderAddrRequest: wiretype end group for non-group") + return fmt.Errorf("proto: PairValConAddrProviderAndConsumer: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorProviderAddrRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PairValConAddrProviderAndConsumer: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4059,7 +6308,7 @@ func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -4093,61 +6342,11 @@ func (m *QueryValidatorProviderAddrRequest) Unmarshal(dAtA []byte) error { } m.ConsumerAddress = 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 *QueryValidatorProviderAddrResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryValidatorProviderAddrResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorProviderAddrResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4157,23 +6356,27 @@ func (m *QueryValidatorProviderAddrResponse) 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.ProviderAddress = string(dAtA[iNdEx:postIndex]) + if m.ConsumerKey == nil { + m.ConsumerKey = &crypto.PublicKey{} + } + if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -4196,7 +6399,7 @@ func (m *QueryValidatorProviderAddrResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryThrottleStateRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4219,10 +6422,10 @@ func (m *QueryThrottleStateRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryThrottleStateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryThrottleStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4246,7 +6449,7 @@ func (m *QueryThrottleStateRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryThrottleStateResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4269,53 +6472,15 @@ func (m *QueryThrottleStateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryThrottleStateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryThrottleStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SlashMeter", wireType) - } - m.SlashMeter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SlashMeter |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SlashMeterAllowance", wireType) - } - m.SlashMeterAllowance = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SlashMeterAllowance |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextReplenishCandidate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4342,7 +6507,7 @@ func (m *QueryThrottleStateResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.NextReplenishCandidate, dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4367,7 +6532,7 @@ func (m *QueryThrottleStateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRegisteredConsumerRewardDenomsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainOptedInValidatorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4390,12 +6555,44 @@ func (m *QueryRegisteredConsumerRewardDenomsRequest) Unmarshal(dAtA []byte) erro fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + 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 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.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4417,7 +6614,7 @@ func (m *QueryRegisteredConsumerRewardDenomsRequest) Unmarshal(dAtA []byte) erro } return nil } -func (m *QueryRegisteredConsumerRewardDenomsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainOptedInValidatorsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4440,15 +6637,15 @@ func (m *QueryRegisteredConsumerRewardDenomsResponse) Unmarshal(dAtA []byte) err fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainOptedInValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsProviderAddresses", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4473,61 +6670,11 @@ func (m *QueryRegisteredConsumerRewardDenomsResponse) Unmarshal(dAtA []byte) err if postIndex < 0 { return ErrInvalidLengthQuery } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denoms = append(m.Denoms, 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 *QueryProposedChainIDsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryProposedChainIDsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposedChainIDsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorsProviderAddresses = append(m.ValidatorsProviderAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4549,7 +6696,7 @@ func (m *QueryProposedChainIDsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryProposedChainIDsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerValidatorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4572,17 +6719,17 @@ func (m *QueryProposedChainIDsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryProposedChainIDsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerValidatorsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposedChainIDsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposedChains", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4592,25 +6739,23 @@ func (m *QueryProposedChainIDsResponse) 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 } - m.ProposedChains = append(m.ProposedChains, ProposedChain{}) - if err := m.ProposedChains[len(m.ProposedChains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4633,7 +6778,7 @@ func (m *QueryProposedChainIDsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ProposedChain) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerValidatorsValidator) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4656,15 +6801,15 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ProposedChain: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerValidatorsValidator: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ProposedChain: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerValidatorsValidator: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4692,13 +6837,49 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainID = string(dAtA[iNdEx:postIndex]) + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", 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.ConsumerKey == nil { + m.ConsumerKey = &crypto.PublicKey{} + } + if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) } - m.ProposalID = 0 + m.Power = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4708,7 +6889,7 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ProposalID |= uint64(b&0x7F) << shift + m.Power |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -4734,7 +6915,7 @@ func (m *ProposedChain) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerValidatorsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4757,17 +6938,17 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerValidatorsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4777,23 +6958,25 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) } 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]) + m.Validators = append(m.Validators, &QueryConsumerValidatorsValidator{}) + if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -4816,7 +6999,7 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDRequest) Unmarshal(dAtA []byte) } return nil } -func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainsValidatorHasToValidateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4839,17 +7022,17 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPairsValConAddrByConsumerChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PairValConAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4859,25 +7042,23 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte } 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 } - m.PairValConAddr = append(m.PairValConAddr, &PairValConAddrProviderAndConsumer{}) - if err := m.PairValConAddr[len(m.PairValConAddr)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4900,7 +7081,7 @@ func (m *QueryAllPairsValConAddrByConsumerChainIDResponse) Unmarshal(dAtA []byte } return nil } -func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { +func (m *QueryConsumerChainsValidatorHasToValidateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4923,15 +7104,15 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PairValConAddrProviderAndConsumer: wiretype end group for non-group") + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PairValConAddrProviderAndConsumer: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryConsumerChainsValidatorHasToValidateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerChainIds", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4959,11 +7140,61 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddress = string(dAtA[iNdEx:postIndex]) + m.ConsumerChainIds = append(m.ConsumerChainIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 2: + 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 *QueryValidatorConsumerCommissionRateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorConsumerCommissionRateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4991,13 +7222,13 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsumerAddress = string(dAtA[iNdEx:postIndex]) + m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5007,27 +7238,23 @@ func (m *PairValConAddrProviderAndConsumer) 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 m.ConsumerKey == nil { - m.ConsumerKey = &crypto.PublicKey{} - } - if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5050,57 +7277,7 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryValidatorConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5123,17 +7300,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: QueryValidatorConsumerCommissionRateResponse: 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: QueryValidatorConsumerCommissionRateResponse: 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 Rate", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5143,22 +7320,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 { + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/ccv/provider/types/query.pb.gw.go b/x/ccv/provider/types/query.pb.gw.go index 0ebfbfa6fd..16bb010d71 100644 --- a/x/ccv/provider/types/query.pb.gw.go +++ b/x/ccv/provider/types/query.pb.gw.go @@ -321,6 +321,190 @@ func local_request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Ma } +func request_Query_QueryConsumerChainOptedInValidators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerChainOptedInValidatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + msg, err := client.QueryConsumerChainOptedInValidators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryConsumerChainOptedInValidators_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerChainOptedInValidatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + msg, err := server.QueryConsumerChainOptedInValidators(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryConsumerChainsValidatorHasToValidate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerChainsValidatorHasToValidateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["provider_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider_address") + } + + protoReq.ProviderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider_address", err) + } + + msg, err := client.QueryConsumerChainsValidatorHasToValidate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryConsumerChainsValidatorHasToValidate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerChainsValidatorHasToValidateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["provider_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider_address") + } + + protoReq.ProviderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider_address", err) + } + + msg, err := server.QueryConsumerChainsValidatorHasToValidate(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorConsumerCommissionRateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + val, ok = pathParams["provider_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider_address") + } + + protoReq.ProviderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider_address", err) + } + + msg, err := client.QueryValidatorConsumerCommissionRate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryValidatorConsumerCommissionRateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + val, ok = pathParams["provider_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "provider_address") + } + + protoReq.ProviderAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "provider_address", err) + } + + msg, err := server.QueryValidatorConsumerCommissionRate(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_QueryOldestUnconfirmedVsc_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryOldestUnconfirmedVscRequest var metadata runtime.ServerMetadata @@ -375,6 +559,60 @@ func local_request_Query_QueryOldestUnconfirmedVsc_0(ctx context.Context, marsha } +func request_Query_QueryConsumerValidators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerValidatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + msg, err := client.QueryConsumerValidators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryConsumerValidators_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConsumerValidatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + msg, err := server.QueryConsumerValidators(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. @@ -634,6 +872,75 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryConsumerChainOptedInValidators_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_QueryConsumerChainOptedInValidators_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_QueryConsumerChainOptedInValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryConsumerChainsValidatorHasToValidate_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_QueryConsumerChainsValidatorHasToValidate_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_QueryConsumerChainsValidatorHasToValidate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryValidatorConsumerCommissionRate_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_QueryValidatorConsumerCommissionRate_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_QueryValidatorConsumerCommissionRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryOldestUnconfirmedVsc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -657,6 +964,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryConsumerValidators_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_QueryConsumerValidators_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_QueryConsumerValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -918,6 +1248,66 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryConsumerChainOptedInValidators_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_QueryConsumerChainOptedInValidators_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_QueryConsumerChainOptedInValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryConsumerChainsValidatorHasToValidate_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_QueryConsumerChainsValidatorHasToValidate_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_QueryConsumerChainsValidatorHasToValidate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryValidatorConsumerCommissionRate_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_QueryValidatorConsumerCommissionRate_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_QueryValidatorConsumerCommissionRate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_QueryOldestUnconfirmedVsc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -938,6 +1328,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryConsumerValidators_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_QueryConsumerValidators_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_QueryConsumerValidators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -964,7 +1374,15 @@ var ( pattern_Query_QueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryConsumerChainOptedInValidators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "opted_in_validators", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryConsumerChainsValidatorHasToValidate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_chains_per_validator", "provider_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryValidatorConsumerCommissionRate_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{"interchain_security", "ccv", "provider", "consumer_commission_rate", "chain_id", "provider_address"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryOldestUnconfirmedVsc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "oldest_unconfirmed_vsc", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryConsumerValidators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_validators", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -990,5 +1408,13 @@ var ( forward_Query_QueryParams_0 = runtime.ForwardResponseMessage + forward_Query_QueryConsumerChainOptedInValidators_0 = runtime.ForwardResponseMessage + + forward_Query_QueryConsumerChainsValidatorHasToValidate_0 = runtime.ForwardResponseMessage + + forward_Query_QueryValidatorConsumerCommissionRate_0 = runtime.ForwardResponseMessage + forward_Query_QueryOldestUnconfirmedVsc_0 = runtime.ForwardResponseMessage + + forward_Query_QueryConsumerValidators_0 = runtime.ForwardResponseMessage ) diff --git a/x/ccv/provider/types/tx.pb.go b/x/ccv/provider/types/tx.pb.go index e0ddad16ba..d8e2ce1647 100644 --- a/x/ccv/provider/types/tx.pb.go +++ b/x/ccv/provider/types/tx.pb.go @@ -5,6 +5,7 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" types "github.com/cometbft/cometbft/proto/tendermint/types" _ "github.com/cosmos/cosmos-proto" @@ -373,7 +374,7 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo // MsgConsumerAddition defines the message used to spawn a new consumer chain using a v1 governance proposal. -// If it passes, then all validators on the provider chain are expected to validate +// If it passes, then all ˝validators on the provider chain are expected to validate // the consumer chain at spawn time or get slashed. // It is recommended that spawn time occurs after the proposal end time. // @@ -425,8 +426,27 @@ type MsgConsumerAddition struct { // chain. it is most relevant for chains performing a sovereign to consumer // changeover in order to maintan the existing ibc transfer channel DistributionTransmissionChannel string `protobuf:"bytes,12,opt,name=distribution_transmission_channel,json=distributionTransmissionChannel,proto3" json:"distribution_transmission_channel,omitempty"` + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + Top_N uint32 `protobuf:"varint,13,opt,name=top_N,json=topN,proto3" json:"top_N,omitempty"` + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + ValidatorsPowerCap uint32 `protobuf:"varint,14,opt,name=validators_power_cap,json=validatorsPowerCap,proto3" json:"validators_power_cap,omitempty"` + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + ValidatorSetCap uint32 `protobuf:"varint,15,opt,name=validator_set_cap,json=validatorSetCap,proto3" json:"validator_set_cap,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + Allowlist []string `protobuf:"bytes,16,rep,name=allowlist,proto3" json:"allowlist,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + Denylist []string `protobuf:"bytes,17,rep,name=denylist,proto3" json:"denylist,omitempty"` // signer address - Authority string `protobuf:"bytes,13,opt,name=authority,proto3" json:"authority,omitempty"` + Authority string `protobuf:"bytes,18,opt,name=authority,proto3" json:"authority,omitempty"` } func (m *MsgConsumerAddition) Reset() { *m = MsgConsumerAddition{} } @@ -546,6 +566,41 @@ func (m *MsgConsumerAddition) GetDistributionTransmissionChannel() string { return "" } +func (m *MsgConsumerAddition) GetTop_N() uint32 { + if m != nil { + return m.Top_N + } + return 0 +} + +func (m *MsgConsumerAddition) GetValidatorsPowerCap() uint32 { + if m != nil { + return m.ValidatorsPowerCap + } + return 0 +} + +func (m *MsgConsumerAddition) GetValidatorSetCap() uint32 { + if m != nil { + return m.ValidatorSetCap + } + return 0 +} + +func (m *MsgConsumerAddition) GetAllowlist() []string { + if m != nil { + return m.Allowlist + } + return nil +} + +func (m *MsgConsumerAddition) GetDenylist() []string { + if m != nil { + return m.Denylist + } + return nil +} + func (m *MsgConsumerAddition) GetAuthority() string { if m != nil { return m.Authority @@ -801,6 +856,411 @@ func (m *MsgChangeRewardDenomsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgChangeRewardDenomsResponse proto.InternalMessageInfo +type MsgOptIn struct { + // the chain id of the consumer chain to opt in to + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // the validator address on the provider + ProviderAddr string `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty" yaml:"address"` + // (optional) The consensus public key to use on the consumer in json string format corresponding to proto-any, + // for example `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`. + // This field is optional and can remain empty (i.e., `consumer_key = ""`). A validator can always change the + // consumer public key at a later stage by issuing a `MsgAssignConsumerKey` message. + ConsumerKey string `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` +} + +func (m *MsgOptIn) Reset() { *m = MsgOptIn{} } +func (m *MsgOptIn) String() string { return proto.CompactTextString(m) } +func (*MsgOptIn) ProtoMessage() {} +func (*MsgOptIn) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{14} +} +func (m *MsgOptIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgOptIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgOptIn.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgOptIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgOptIn.Merge(m, src) +} +func (m *MsgOptIn) XXX_Size() int { + return m.Size() +} +func (m *MsgOptIn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgOptIn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgOptIn proto.InternalMessageInfo + +type MsgOptInResponse struct { +} + +func (m *MsgOptInResponse) Reset() { *m = MsgOptInResponse{} } +func (m *MsgOptInResponse) String() string { return proto.CompactTextString(m) } +func (*MsgOptInResponse) ProtoMessage() {} +func (*MsgOptInResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{15} +} +func (m *MsgOptInResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgOptInResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgOptInResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgOptInResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgOptInResponse.Merge(m, src) +} +func (m *MsgOptInResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgOptInResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgOptInResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgOptInResponse proto.InternalMessageInfo + +type MsgOptOut struct { + // the chain id of the consumer chain to opt out from + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // the validator address on the provider + ProviderAddr string `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty" yaml:"address"` +} + +func (m *MsgOptOut) Reset() { *m = MsgOptOut{} } +func (m *MsgOptOut) String() string { return proto.CompactTextString(m) } +func (*MsgOptOut) ProtoMessage() {} +func (*MsgOptOut) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{16} +} +func (m *MsgOptOut) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgOptOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgOptOut.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgOptOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgOptOut.Merge(m, src) +} +func (m *MsgOptOut) XXX_Size() int { + return m.Size() +} +func (m *MsgOptOut) XXX_DiscardUnknown() { + xxx_messageInfo_MsgOptOut.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgOptOut proto.InternalMessageInfo + +type MsgOptOutResponse struct { +} + +func (m *MsgOptOutResponse) Reset() { *m = MsgOptOutResponse{} } +func (m *MsgOptOutResponse) String() string { return proto.CompactTextString(m) } +func (*MsgOptOutResponse) ProtoMessage() {} +func (*MsgOptOutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{17} +} +func (m *MsgOptOutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgOptOutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgOptOutResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgOptOutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgOptOutResponse.Merge(m, src) +} +func (m *MsgOptOutResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgOptOutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgOptOutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgOptOutResponse proto.InternalMessageInfo + +// MsgSetConsumerCommissionRate allows validators to set +// a per-consumer chain commission rate +type MsgSetConsumerCommissionRate struct { + // The validator address on the provider + ProviderAddr string `protobuf:"bytes,1,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty" yaml:"address"` + // The chain id of the consumer chain to set a commission rate + ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // The rate to charge delegators on the consumer chain, as a fraction + // TODO: migrate rate from sdk.Dec to math.LegacyDec + Rate cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=rate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rate"` +} + +func (m *MsgSetConsumerCommissionRate) Reset() { *m = MsgSetConsumerCommissionRate{} } +func (m *MsgSetConsumerCommissionRate) String() string { return proto.CompactTextString(m) } +func (*MsgSetConsumerCommissionRate) ProtoMessage() {} +func (*MsgSetConsumerCommissionRate) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{18} +} +func (m *MsgSetConsumerCommissionRate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetConsumerCommissionRate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetConsumerCommissionRate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetConsumerCommissionRate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetConsumerCommissionRate.Merge(m, src) +} +func (m *MsgSetConsumerCommissionRate) XXX_Size() int { + return m.Size() +} +func (m *MsgSetConsumerCommissionRate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetConsumerCommissionRate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetConsumerCommissionRate proto.InternalMessageInfo + +type MsgSetConsumerCommissionRateResponse struct { +} + +func (m *MsgSetConsumerCommissionRateResponse) Reset() { *m = MsgSetConsumerCommissionRateResponse{} } +func (m *MsgSetConsumerCommissionRateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetConsumerCommissionRateResponse) ProtoMessage() {} +func (*MsgSetConsumerCommissionRateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{19} +} +func (m *MsgSetConsumerCommissionRateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetConsumerCommissionRateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetConsumerCommissionRateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetConsumerCommissionRateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetConsumerCommissionRateResponse.Merge(m, src) +} +func (m *MsgSetConsumerCommissionRateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetConsumerCommissionRateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetConsumerCommissionRateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetConsumerCommissionRateResponse proto.InternalMessageInfo + +// MsgConsumerModification message contains a governance proposal on the provider chain to +// modify a running consumer chain. If it passes, the consumer chain's +// parameters are updated. +// +// Note: this replaces ConsumerModificationProposal which is deprecated and will be removed soon +type MsgConsumerModification struct { + // the title of the proposal + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // the description of the proposal + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // the chain-id of the consumer chain to be modified + ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // Corresponds to the percentage of validators that have to validate the chain under the Top N case. + // For example, 53 corresponds to a Top 53% chain, meaning that the top 53% provider validators by voting power + // have to validate the proposed consumer chain. top_N can either be 0 or any value in [50, 100]. + // A chain can join with top_N == 0 as an Opt In chain, or with top_N ∈ [50, 100] as a Top N chain. + Top_N uint32 `protobuf:"varint,4,opt,name=top_N,json=topN,proto3" json:"top_N,omitempty"` + // Corresponds to the maximum power (percentage-wise) a validator can have on the consumer chain. For instance, if + // `validators_power_cap` is set to 32, it means that no validator can have more than 32% of the voting power on the + // consumer chain. Note that this might not be feasible. For example, think of a consumer chain with only + // 5 validators and with `validators_power_cap` set to 10%. In such a scenario, at least one validator would need + // to have more than 20% of the total voting power. Therefore, `validators_power_cap` operates on a best-effort basis. + ValidatorsPowerCap uint32 `protobuf:"varint,5,opt,name=validators_power_cap,json=validatorsPowerCap,proto3" json:"validators_power_cap,omitempty"` + // Corresponds to the maximum number of validators that can validate a consumer chain. + // Only applicable to Opt In chains. Setting `validator_set_cap` on a Top N chain is a no-op. + ValidatorSetCap uint32 `protobuf:"varint,6,opt,name=validator_set_cap,json=validatorSetCap,proto3" json:"validator_set_cap,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that are the ONLY ones that can validate + // the consumer chain. + Allowlist []string `protobuf:"bytes,7,rep,name=allowlist,proto3" json:"allowlist,omitempty"` + // Corresponds to a list of provider consensus addresses of validators that CANNOT validate the consumer chain. + Denylist []string `protobuf:"bytes,8,rep,name=denylist,proto3" json:"denylist,omitempty"` + // signer address + Authority string `protobuf:"bytes,9,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgConsumerModification) Reset() { *m = MsgConsumerModification{} } +func (m *MsgConsumerModification) String() string { return proto.CompactTextString(m) } +func (*MsgConsumerModification) ProtoMessage() {} +func (*MsgConsumerModification) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{20} +} +func (m *MsgConsumerModification) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgConsumerModification) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgConsumerModification.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgConsumerModification) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgConsumerModification.Merge(m, src) +} +func (m *MsgConsumerModification) XXX_Size() int { + return m.Size() +} +func (m *MsgConsumerModification) XXX_DiscardUnknown() { + xxx_messageInfo_MsgConsumerModification.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgConsumerModification proto.InternalMessageInfo + +func (m *MsgConsumerModification) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *MsgConsumerModification) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *MsgConsumerModification) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *MsgConsumerModification) GetTop_N() uint32 { + if m != nil { + return m.Top_N + } + return 0 +} + +func (m *MsgConsumerModification) GetValidatorsPowerCap() uint32 { + if m != nil { + return m.ValidatorsPowerCap + } + return 0 +} + +func (m *MsgConsumerModification) GetValidatorSetCap() uint32 { + if m != nil { + return m.ValidatorSetCap + } + return 0 +} + +func (m *MsgConsumerModification) GetAllowlist() []string { + if m != nil { + return m.Allowlist + } + return nil +} + +func (m *MsgConsumerModification) GetDenylist() []string { + if m != nil { + return m.Denylist + } + return nil +} + +func (m *MsgConsumerModification) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +type MsgConsumerModificationResponse struct { +} + +func (m *MsgConsumerModificationResponse) Reset() { *m = MsgConsumerModificationResponse{} } +func (m *MsgConsumerModificationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgConsumerModificationResponse) ProtoMessage() {} +func (*MsgConsumerModificationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{21} +} +func (m *MsgConsumerModificationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgConsumerModificationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgConsumerModificationResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgConsumerModificationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgConsumerModificationResponse.Merge(m, src) +} +func (m *MsgConsumerModificationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgConsumerModificationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgConsumerModificationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgConsumerModificationResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgAssignConsumerKey)(nil), "interchain_security.ccv.provider.v1.MsgAssignConsumerKey") proto.RegisterType((*MsgAssignConsumerKeyResponse)(nil), "interchain_security.ccv.provider.v1.MsgAssignConsumerKeyResponse") @@ -816,6 +1276,14 @@ func init() { proto.RegisterType((*MsgConsumerRemovalResponse)(nil), "interchain_security.ccv.provider.v1.MsgConsumerRemovalResponse") proto.RegisterType((*MsgChangeRewardDenoms)(nil), "interchain_security.ccv.provider.v1.MsgChangeRewardDenoms") proto.RegisterType((*MsgChangeRewardDenomsResponse)(nil), "interchain_security.ccv.provider.v1.MsgChangeRewardDenomsResponse") + proto.RegisterType((*MsgOptIn)(nil), "interchain_security.ccv.provider.v1.MsgOptIn") + proto.RegisterType((*MsgOptInResponse)(nil), "interchain_security.ccv.provider.v1.MsgOptInResponse") + proto.RegisterType((*MsgOptOut)(nil), "interchain_security.ccv.provider.v1.MsgOptOut") + proto.RegisterType((*MsgOptOutResponse)(nil), "interchain_security.ccv.provider.v1.MsgOptOutResponse") + proto.RegisterType((*MsgSetConsumerCommissionRate)(nil), "interchain_security.ccv.provider.v1.MsgSetConsumerCommissionRate") + proto.RegisterType((*MsgSetConsumerCommissionRateResponse)(nil), "interchain_security.ccv.provider.v1.MsgSetConsumerCommissionRateResponse") + proto.RegisterType((*MsgConsumerModification)(nil), "interchain_security.ccv.provider.v1.MsgConsumerModification") + proto.RegisterType((*MsgConsumerModificationResponse)(nil), "interchain_security.ccv.provider.v1.MsgConsumerModificationResponse") } func init() { @@ -823,89 +1291,113 @@ func init() { } var fileDescriptor_43221a4391e9fbf4 = []byte{ - // 1305 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x8f, 0x14, 0xc5, - 0x17, 0xdf, 0x66, 0x61, 0xd9, 0xad, 0xfd, 0xc1, 0xd2, 0xb0, 0xdf, 0x9d, 0x9d, 0x2f, 0xcc, 0x2c, - 0xe3, 0x0f, 0x08, 0x42, 0xb7, 0xac, 0x3f, 0xd0, 0x8d, 0x46, 0x67, 0x59, 0x14, 0x30, 0xab, 0x6b, - 0xb3, 0x62, 0xa2, 0x89, 0x9d, 0x9a, 0xee, 0xa2, 0xbb, 0xc2, 0x74, 0xd5, 0xa4, 0xaa, 0xba, 0x61, - 0x6e, 0x86, 0x93, 0x89, 0x89, 0xc1, 0x9b, 0x47, 0x62, 0x3c, 0x6a, 0xc2, 0xc1, 0x93, 0x37, 0x6f, - 0x1c, 0x89, 0xf1, 0xe0, 0x09, 0x09, 0x1c, 0xf0, 0xec, 0x5f, 0x60, 0xea, 0x47, 0xf7, 0xf4, 0xec, - 0x0e, 0xcb, 0x30, 0x7a, 0x99, 0x74, 0xd7, 0xfb, 0xbc, 0xcf, 0xfb, 0xbc, 0xd7, 0xf5, 0x5e, 0xd5, - 0x80, 0x53, 0x98, 0x08, 0xc4, 0x82, 0x18, 0x62, 0xe2, 0x73, 0x14, 0xa4, 0x0c, 0x8b, 0xae, 0x1b, - 0x04, 0x99, 0xdb, 0x61, 0x34, 0xc3, 0x21, 0x62, 0x6e, 0x76, 0xc6, 0x15, 0x37, 0x9c, 0x0e, 0xa3, - 0x82, 0xda, 0xcf, 0x0d, 0x40, 0x3b, 0x41, 0x90, 0x39, 0x39, 0xda, 0xc9, 0xce, 0x54, 0x0f, 0xc2, - 0x04, 0x13, 0xea, 0xaa, 0x5f, 0xed, 0x57, 0x3d, 0x12, 0x51, 0x1a, 0xb5, 0x91, 0x0b, 0x3b, 0xd8, - 0x85, 0x84, 0x50, 0x01, 0x05, 0xa6, 0x84, 0x1b, 0x6b, 0xdd, 0x58, 0xd5, 0x5b, 0x2b, 0xbd, 0xea, - 0x0a, 0x9c, 0x20, 0x2e, 0x60, 0xd2, 0x31, 0x80, 0xda, 0x76, 0x40, 0x98, 0x32, 0xc5, 0x60, 0xec, - 0x4b, 0xdb, 0xed, 0x90, 0x74, 0x8d, 0xe9, 0x70, 0x44, 0x23, 0xaa, 0x1e, 0x5d, 0xf9, 0x94, 0x3b, - 0x04, 0x94, 0x27, 0x94, 0xfb, 0xda, 0xa0, 0x5f, 0x8c, 0x69, 0x51, 0xbf, 0xb9, 0x09, 0x8f, 0x64, - 0xea, 0x09, 0x8f, 0x72, 0x95, 0xb8, 0x15, 0xb8, 0x01, 0x65, 0xc8, 0x0d, 0xda, 0x18, 0x11, 0x21, - 0xad, 0xfa, 0xc9, 0x00, 0x56, 0x86, 0x29, 0x65, 0x51, 0x28, 0xed, 0xe3, 0x4a, 0xd2, 0x36, 0x8e, - 0x62, 0xa1, 0xa9, 0xb8, 0x2b, 0x10, 0x09, 0x11, 0x4b, 0xb0, 0x0e, 0xd0, 0x7b, 0xcb, 0x55, 0x94, - 0xec, 0xa2, 0xdb, 0x41, 0xdc, 0x45, 0x92, 0x8f, 0x04, 0x48, 0x03, 0x1a, 0xbf, 0x5b, 0xe0, 0xf0, - 0x06, 0x8f, 0x9a, 0x9c, 0xe3, 0x88, 0x9c, 0xa3, 0x84, 0xa7, 0x09, 0x62, 0x1f, 0xa0, 0xae, 0xbd, - 0x04, 0x26, 0xb5, 0x36, 0x1c, 0x56, 0xac, 0x65, 0xeb, 0xc4, 0x94, 0xb7, 0x5f, 0xbd, 0x5f, 0x0c, - 0xed, 0xb3, 0x60, 0x36, 0xd7, 0xe5, 0xc3, 0x30, 0x64, 0x95, 0x3d, 0xd2, 0xbe, 0x66, 0xff, 0x7d, - 0xbf, 0x3e, 0xd7, 0x85, 0x49, 0x7b, 0xb5, 0x21, 0x57, 0x11, 0xe7, 0x0d, 0x6f, 0x26, 0x07, 0x36, - 0xc3, 0x90, 0xd9, 0xc7, 0xc0, 0x4c, 0x60, 0x42, 0xf8, 0xd7, 0x50, 0xb7, 0x32, 0xae, 0x78, 0xa7, - 0x83, 0x52, 0xd8, 0x97, 0xc1, 0x84, 0x54, 0x82, 0x58, 0x65, 0xaf, 0x22, 0xad, 0xfc, 0xf6, 0xf3, - 0xe9, 0xc3, 0xa6, 0xe2, 0x4d, 0xcd, 0x7a, 0x59, 0x30, 0x4c, 0x22, 0xcf, 0xe0, 0x56, 0x0f, 0x7d, - 0x75, 0xbb, 0x3e, 0xf6, 0xd7, 0xed, 0xfa, 0xd8, 0xcd, 0xc7, 0x77, 0x4e, 0x9a, 0xc5, 0x46, 0x0d, - 0x1c, 0x19, 0x94, 0x95, 0x87, 0x78, 0x87, 0x12, 0x8e, 0x1a, 0xbf, 0x5a, 0xe0, 0xe8, 0x06, 0x8f, - 0x2e, 0xa7, 0xad, 0x04, 0x8b, 0x1c, 0xb0, 0x81, 0x79, 0x0b, 0xc5, 0x30, 0xc3, 0x34, 0x65, 0xf6, - 0xeb, 0x60, 0x8a, 0x2b, 0xab, 0x40, 0x4c, 0x17, 0x60, 0x17, 0x2d, 0x3d, 0xa8, 0xbd, 0x09, 0x66, - 0x92, 0x12, 0x8f, 0xaa, 0xcd, 0xf4, 0xca, 0x29, 0x07, 0xb7, 0x02, 0xa7, 0xfc, 0xe5, 0x9c, 0xd2, - 0xb7, 0xca, 0xce, 0x38, 0xe5, 0xd8, 0x5e, 0x1f, 0xc3, 0xea, 0xff, 0xca, 0x09, 0xf6, 0x22, 0x35, - 0x8e, 0x83, 0x17, 0x76, 0x4d, 0xa1, 0x48, 0xf6, 0xce, 0x9e, 0x01, 0xc9, 0xae, 0xd3, 0xb4, 0xd5, - 0x46, 0x57, 0xa8, 0xc0, 0x24, 0x1a, 0x39, 0x59, 0x1f, 0x2c, 0x86, 0x69, 0xa7, 0x8d, 0x03, 0x28, - 0x90, 0x9f, 0x51, 0x81, 0xfc, 0x7c, 0x7b, 0x99, 0xbc, 0x8f, 0x97, 0xd3, 0x54, 0x1b, 0xd0, 0x59, - 0xcf, 0x1d, 0xae, 0x50, 0x81, 0xce, 0x1b, 0xb8, 0xb7, 0x10, 0x0e, 0x5a, 0xb6, 0xbf, 0x00, 0x8b, - 0x98, 0x5c, 0x65, 0x30, 0x90, 0xed, 0xeb, 0xb7, 0xda, 0x34, 0xb8, 0xe6, 0xc7, 0x08, 0x86, 0x88, - 0xa9, 0xcd, 0x33, 0xbd, 0xf2, 0xe2, 0xd3, 0x0a, 0x7b, 0x41, 0xa1, 0xbd, 0x85, 0x1e, 0xcd, 0x9a, - 0x64, 0xd1, 0xcb, 0xcf, 0x54, 0xdb, 0x72, 0xc5, 0x8a, 0xda, 0xfe, 0x60, 0x81, 0x03, 0x1b, 0x3c, - 0xfa, 0xa4, 0x13, 0x42, 0x81, 0x36, 0x21, 0x83, 0x09, 0x97, 0xd5, 0x84, 0xa9, 0x88, 0xa9, 0xec, - 0xe8, 0xa7, 0x57, 0xb3, 0x80, 0xda, 0x17, 0xc1, 0x44, 0x47, 0x31, 0x98, 0xe2, 0xbd, 0xe4, 0x0c, - 0x31, 0x3f, 0x1d, 0x1d, 0x74, 0x6d, 0xef, 0xdd, 0xfb, 0xf5, 0x31, 0xcf, 0x10, 0xac, 0xce, 0xa9, - 0x7c, 0x0a, 0xea, 0xc6, 0x12, 0x58, 0xdc, 0xa6, 0xb2, 0xc8, 0xe0, 0xc1, 0x04, 0x38, 0xb4, 0xc1, - 0xa3, 0x3c, 0xcb, 0x66, 0x18, 0x62, 0x59, 0xa5, 0xdd, 0x06, 0xc0, 0xfb, 0x60, 0x0e, 0x13, 0x2c, - 0x30, 0x6c, 0xfb, 0x31, 0x92, 0xa5, 0x37, 0x82, 0xab, 0xea, 0x63, 0xc8, 0xa1, 0xe7, 0x98, 0x51, - 0xa7, 0x3e, 0x80, 0x44, 0x18, 0x7d, 0xb3, 0xc6, 0x4f, 0x2f, 0xca, 0x81, 0x10, 0x21, 0x82, 0x38, - 0xe6, 0x7e, 0x0c, 0x79, 0xac, 0xbe, 0xe9, 0x8c, 0x37, 0x6d, 0xd6, 0x2e, 0x40, 0x1e, 0xdb, 0x75, - 0x30, 0xdd, 0xc2, 0x04, 0xb2, 0xae, 0x46, 0xec, 0x55, 0x08, 0xa0, 0x97, 0x14, 0xe0, 0x1c, 0x00, - 0xbc, 0x03, 0xaf, 0x13, 0x5f, 0x1e, 0x03, 0x95, 0x7d, 0x46, 0x88, 0x1e, 0xf1, 0x4e, 0x3e, 0xe2, - 0x9d, 0xad, 0xfc, 0x8c, 0x58, 0x9b, 0x94, 0x42, 0x6e, 0xfd, 0x59, 0xb7, 0xbc, 0x29, 0xe5, 0x27, - 0x2d, 0xf6, 0x87, 0x60, 0x3e, 0x25, 0x2d, 0x4a, 0x42, 0x4c, 0x22, 0xbf, 0x83, 0x18, 0xa6, 0x61, - 0x65, 0x42, 0x51, 0x2d, 0xed, 0xa0, 0x5a, 0x37, 0xa7, 0x89, 0x66, 0xfa, 0x4e, 0x32, 0x1d, 0x28, - 0x9c, 0x37, 0x95, 0xaf, 0xfd, 0x31, 0xb0, 0x83, 0x20, 0x53, 0x92, 0x68, 0x2a, 0x72, 0xc6, 0xfd, - 0xc3, 0x33, 0xce, 0x07, 0x41, 0xb6, 0xa5, 0xbd, 0x0d, 0xe5, 0xe7, 0x60, 0x51, 0x30, 0x48, 0xf8, - 0x55, 0xc4, 0xb6, 0xf3, 0x4e, 0x0e, 0xcf, 0xbb, 0x90, 0x73, 0xf4, 0x93, 0x5f, 0x00, 0xcb, 0xc5, - 0x64, 0x66, 0x28, 0xc4, 0x5c, 0x30, 0xdc, 0x4a, 0x55, 0xd3, 0xe5, 0x6d, 0x53, 0x99, 0x52, 0x9b, - 0xa0, 0x96, 0xe3, 0xbc, 0x3e, 0xd8, 0x7b, 0x06, 0x65, 0x7f, 0x04, 0x9e, 0x57, 0x6d, 0xca, 0xa5, - 0x38, 0xbf, 0x8f, 0x49, 0x85, 0x4e, 0x30, 0xe7, 0x92, 0x0d, 0x2c, 0x5b, 0x27, 0xc6, 0xbd, 0x63, - 0x1a, 0xbb, 0x89, 0xd8, 0x7a, 0x09, 0xb9, 0x55, 0x02, 0xda, 0xa7, 0x81, 0x1d, 0x63, 0x2e, 0x28, - 0xc3, 0x01, 0x6c, 0xfb, 0x88, 0x08, 0x86, 0x11, 0xaf, 0x4c, 0x2b, 0xf7, 0x83, 0x3d, 0xcb, 0x79, - 0x6d, 0xb0, 0x2f, 0x81, 0x63, 0x4f, 0x0c, 0xea, 0x07, 0x31, 0x24, 0x04, 0xb5, 0x2b, 0x33, 0x2a, - 0x95, 0x7a, 0xf8, 0x84, 0x98, 0xe7, 0x34, 0xac, 0xbf, 0x91, 0x67, 0x87, 0x6e, 0xe4, 0x1d, 0xdd, - 0x77, 0x14, 0xfc, 0x7f, 0x40, 0x87, 0x15, 0x1d, 0xf8, 0x8b, 0x05, 0xec, 0x92, 0xdd, 0x43, 0x09, - 0xcd, 0x60, 0x7b, 0xb7, 0x06, 0x6c, 0x82, 0x29, 0x2e, 0x68, 0x47, 0x6f, 0xf9, 0x3d, 0xcf, 0xb0, - 0xe5, 0x27, 0xa5, 0x9b, 0xda, 0xf1, 0x7d, 0xb9, 0x8d, 0x8f, 0x9e, 0xdb, 0x11, 0x50, 0xdd, 0xa9, - 0xbd, 0x48, 0xed, 0x27, 0x0b, 0x2c, 0x48, 0x73, 0x0c, 0x49, 0x84, 0x3c, 0x74, 0x1d, 0xb2, 0x70, - 0x1d, 0x11, 0x9a, 0x70, 0xbb, 0x01, 0x66, 0x43, 0xf5, 0xe4, 0x0b, 0x2a, 0x6f, 0x11, 0x15, 0x6b, - 0x79, 0x5c, 0x5e, 0x06, 0xf4, 0xe2, 0x16, 0x6d, 0x86, 0xa1, 0x7d, 0x02, 0xcc, 0xf7, 0x30, 0x4c, - 0x52, 0xcb, 0x6c, 0x25, 0x6c, 0x2e, 0x87, 0xa9, 0x80, 0xff, 0x5d, 0x36, 0x75, 0x75, 0x52, 0xee, - 0x94, 0x9b, 0x27, 0xb4, 0xf2, 0xfd, 0x7e, 0x30, 0xbe, 0xc1, 0x23, 0xfb, 0x5b, 0x0b, 0x1c, 0xdc, - 0x79, 0x69, 0x7a, 0x73, 0xa8, 0x89, 0x3d, 0xe8, 0x66, 0x52, 0x6d, 0x8e, 0xec, 0x9a, 0x6b, 0xb3, - 0x7f, 0xb4, 0x40, 0x75, 0x97, 0x1b, 0xcd, 0xda, 0xb0, 0x11, 0x9e, 0xcc, 0x51, 0xbd, 0xf4, 0xef, - 0x39, 0x76, 0x91, 0xdb, 0x77, 0x27, 0x19, 0x51, 0x6e, 0x99, 0x63, 0x54, 0xb9, 0x83, 0x4e, 0x7a, - 0xfb, 0x1b, 0x0b, 0xcc, 0xef, 0x38, 0x24, 0xdf, 0x18, 0x36, 0xc0, 0x76, 0xcf, 0xea, 0xbb, 0xa3, - 0x7a, 0x16, 0x82, 0xbe, 0xb6, 0xc0, 0x81, 0xed, 0x33, 0xe3, 0xec, 0xb3, 0xb2, 0x1a, 0xc7, 0xea, - 0x3b, 0x23, 0x3a, 0x16, 0x6a, 0x6e, 0x5a, 0x60, 0xa6, 0xef, 0x16, 0xf4, 0xea, 0xb0, 0x8c, 0x65, - 0xaf, 0xea, 0x5b, 0xa3, 0x78, 0xe5, 0x22, 0xaa, 0xfb, 0xbe, 0x7c, 0x7c, 0xe7, 0xa4, 0xb5, 0xf6, - 0xe9, 0xdd, 0x87, 0x35, 0xeb, 0xde, 0xc3, 0x9a, 0xf5, 0xe0, 0x61, 0xcd, 0xba, 0xf5, 0xa8, 0x36, - 0x76, 0xef, 0x51, 0x6d, 0xec, 0x8f, 0x47, 0xb5, 0xb1, 0xcf, 0xde, 0x8e, 0xb0, 0x88, 0xd3, 0x96, - 0x13, 0xd0, 0xc4, 0xfc, 0x8f, 0x73, 0x7b, 0xf1, 0x4e, 0x17, 0x7f, 0xc3, 0xb2, 0xd7, 0xdc, 0x1b, - 0xfd, 0xff, 0xc5, 0xd4, 0xdd, 0xb5, 0x35, 0xa1, 0x86, 0xeb, 0x2b, 0xff, 0x04, 0x00, 0x00, 0xff, - 0xff, 0x3a, 0xa6, 0xa7, 0xc0, 0x07, 0x0f, 0x00, 0x00, + // 1688 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcf, 0x6f, 0x24, 0x47, + 0x15, 0x76, 0xfb, 0xd7, 0xce, 0xd4, 0xf8, 0x67, 0xdb, 0xc6, 0xe3, 0x8e, 0x33, 0x63, 0x0f, 0x21, + 0xb1, 0x96, 0xb8, 0x3b, 0x6b, 0xc8, 0x06, 0xac, 0x20, 0xb0, 0x3d, 0x81, 0xf5, 0x82, 0xd7, 0xa6, + 0xd7, 0x04, 0x09, 0x24, 0x5a, 0x35, 0xdd, 0xe5, 0x9e, 0xd2, 0x76, 0x77, 0xb5, 0xaa, 0x6a, 0xc6, + 0x99, 0x1b, 0xca, 0x09, 0x29, 0x02, 0x85, 0x1b, 0xe2, 0x94, 0x03, 0x07, 0x90, 0x40, 0xda, 0x43, + 0x4e, 0xdc, 0xb8, 0xed, 0x81, 0x43, 0x88, 0x38, 0x20, 0x0e, 0x0b, 0xda, 0x3d, 0x84, 0x33, 0x7f, + 0x01, 0xaa, 0xea, 0xea, 0x9e, 0x1e, 0x7b, 0x3c, 0x99, 0x99, 0x05, 0x71, 0x19, 0x4d, 0xd7, 0xfb, + 0xde, 0xf7, 0xbe, 0xf7, 0xaa, 0xea, 0x55, 0x75, 0x83, 0xd7, 0x71, 0xc4, 0x11, 0x75, 0x9b, 0x10, + 0x47, 0x0e, 0x43, 0x6e, 0x8b, 0x62, 0xde, 0xb1, 0x5c, 0xb7, 0x6d, 0xc5, 0x94, 0xb4, 0xb1, 0x87, + 0xa8, 0xd5, 0xbe, 0x63, 0xf1, 0xf7, 0xcc, 0x98, 0x12, 0x4e, 0xf4, 0x2f, 0xf6, 0x41, 0x9b, 0xae, + 0xdb, 0x36, 0x53, 0xb4, 0xd9, 0xbe, 0x63, 0x2c, 0xc3, 0x10, 0x47, 0xc4, 0x92, 0xbf, 0x89, 0x9f, + 0xb1, 0xe9, 0x13, 0xe2, 0x07, 0xc8, 0x82, 0x31, 0xb6, 0x60, 0x14, 0x11, 0x0e, 0x39, 0x26, 0x11, + 0x53, 0xd6, 0xaa, 0xb2, 0xca, 0xa7, 0x46, 0xeb, 0xc2, 0xe2, 0x38, 0x44, 0x8c, 0xc3, 0x30, 0x56, + 0x80, 0xca, 0x55, 0x80, 0xd7, 0xa2, 0x92, 0x41, 0xd9, 0x37, 0xae, 0xda, 0x61, 0xd4, 0x51, 0xa6, + 0x55, 0x9f, 0xf8, 0x44, 0xfe, 0xb5, 0xc4, 0xbf, 0xd4, 0xc1, 0x25, 0x2c, 0x24, 0xcc, 0x49, 0x0c, + 0xc9, 0x83, 0x32, 0xad, 0x27, 0x4f, 0x56, 0xc8, 0x7c, 0x91, 0x7a, 0xc8, 0xfc, 0x54, 0x25, 0x6e, + 0xb8, 0x96, 0x4b, 0x28, 0xb2, 0xdc, 0x00, 0xa3, 0x88, 0x0b, 0x6b, 0xf2, 0x4f, 0x01, 0xf6, 0x86, + 0x29, 0x65, 0x56, 0xa8, 0xc4, 0xc7, 0x12, 0xa4, 0x01, 0xf6, 0x9b, 0x3c, 0xa1, 0x62, 0x16, 0x47, + 0x91, 0x87, 0x68, 0x88, 0x93, 0x00, 0xdd, 0xa7, 0x54, 0x45, 0xce, 0xce, 0x3b, 0x31, 0x62, 0x16, + 0x12, 0x7c, 0x91, 0x8b, 0x12, 0x40, 0xed, 0xaf, 0x1a, 0x58, 0x3d, 0x61, 0xfe, 0x01, 0x63, 0xd8, + 0x8f, 0x8e, 0x48, 0xc4, 0x5a, 0x21, 0xa2, 0xdf, 0x45, 0x1d, 0x7d, 0x03, 0x14, 0x12, 0x6d, 0xd8, + 0x2b, 0x6b, 0x5b, 0xda, 0x4e, 0xd1, 0xbe, 0x25, 0x9f, 0x8f, 0x3d, 0xfd, 0x2d, 0x30, 0x9f, 0xea, + 0x72, 0xa0, 0xe7, 0xd1, 0xf2, 0xa4, 0xb0, 0x1f, 0xea, 0xff, 0x7e, 0x5a, 0x5d, 0xe8, 0xc0, 0x30, + 0xd8, 0xaf, 0x89, 0x51, 0xc4, 0x58, 0xcd, 0x9e, 0x4b, 0x81, 0x07, 0x9e, 0x47, 0xf5, 0x6d, 0x30, + 0xe7, 0xaa, 0x10, 0xce, 0x23, 0xd4, 0x29, 0x4f, 0x49, 0xde, 0x92, 0x9b, 0x0b, 0xfb, 0x06, 0x98, + 0x15, 0x4a, 0x10, 0x2d, 0x4f, 0x4b, 0xd2, 0xf2, 0xa7, 0x1f, 0xef, 0xae, 0xaa, 0x8a, 0x1f, 0x24, + 0xac, 0x0f, 0x39, 0xc5, 0x91, 0x6f, 0x2b, 0xdc, 0xfe, 0xca, 0xcf, 0x3e, 0xaa, 0x4e, 0xfc, 0xeb, + 0xa3, 0xea, 0xc4, 0xfb, 0x9f, 0x3d, 0xbe, 0xad, 0x06, 0x6b, 0x15, 0xb0, 0xd9, 0x2f, 0x2b, 0x1b, + 0xb1, 0x98, 0x44, 0x0c, 0xd5, 0xfe, 0xa4, 0x81, 0x97, 0x4f, 0x98, 0xff, 0xb0, 0xd5, 0x08, 0x31, + 0x4f, 0x01, 0x27, 0x98, 0x35, 0x50, 0x13, 0xb6, 0x31, 0x69, 0x51, 0xfd, 0x2e, 0x28, 0x32, 0x69, + 0xe5, 0x88, 0x26, 0x05, 0x18, 0xa0, 0xa5, 0x0b, 0xd5, 0xcf, 0xc0, 0x5c, 0x98, 0xe3, 0x91, 0xb5, + 0x29, 0xed, 0xbd, 0x6e, 0xe2, 0x86, 0x6b, 0xe6, 0x67, 0xce, 0xcc, 0xcd, 0x55, 0xfb, 0x8e, 0x99, + 0x8f, 0x6d, 0xf7, 0x30, 0xec, 0x7f, 0x21, 0x9f, 0x60, 0x37, 0x52, 0xed, 0x35, 0xf0, 0xa5, 0x81, + 0x29, 0x64, 0xc9, 0x3e, 0x9e, 0xec, 0x93, 0x6c, 0x9d, 0xb4, 0x1a, 0x01, 0x7a, 0x97, 0x70, 0x1c, + 0xf9, 0x63, 0x27, 0xeb, 0x80, 0x75, 0xaf, 0x15, 0x07, 0xd8, 0x85, 0x1c, 0x39, 0x6d, 0xc2, 0x91, + 0x93, 0x2e, 0x2f, 0x95, 0xf7, 0x6b, 0xf9, 0x34, 0xe5, 0x02, 0x34, 0xeb, 0xa9, 0xc3, 0xbb, 0x84, + 0xa3, 0x77, 0x14, 0xdc, 0x5e, 0xf3, 0xfa, 0x0d, 0xeb, 0x3f, 0x01, 0xeb, 0x38, 0xba, 0xa0, 0xd0, + 0x15, 0xdb, 0xd7, 0x69, 0x04, 0xc4, 0x7d, 0xe4, 0x34, 0x11, 0xf4, 0x10, 0x95, 0x8b, 0xa7, 0xb4, + 0xf7, 0xea, 0xe7, 0x15, 0xf6, 0x9e, 0x44, 0xdb, 0x6b, 0x5d, 0x9a, 0x43, 0xc1, 0x92, 0x0c, 0x8f, + 0x54, 0xdb, 0x7c, 0xc5, 0xb2, 0xda, 0xfe, 0x46, 0x03, 0x8b, 0x27, 0xcc, 0xff, 0x41, 0xec, 0x41, + 0x8e, 0xce, 0x20, 0x85, 0x21, 0x13, 0xd5, 0x84, 0x2d, 0xde, 0x24, 0x62, 0x47, 0x7f, 0x7e, 0x35, + 0x33, 0xa8, 0x7e, 0x0c, 0x66, 0x63, 0xc9, 0xa0, 0x8a, 0xf7, 0x65, 0x73, 0x88, 0xfe, 0x69, 0x26, + 0x41, 0x0f, 0xa7, 0x9f, 0x3c, 0xad, 0x4e, 0xd8, 0x8a, 0x60, 0x7f, 0x41, 0xe6, 0x93, 0x51, 0xd7, + 0x36, 0xc0, 0xfa, 0x15, 0x95, 0x59, 0x06, 0x3f, 0x2f, 0x80, 0x95, 0x13, 0xe6, 0xa7, 0x59, 0x1e, + 0x78, 0x1e, 0x16, 0x55, 0x1a, 0xd4, 0x00, 0xbe, 0x03, 0x16, 0x70, 0x84, 0x39, 0x86, 0x81, 0xd3, + 0x44, 0xa2, 0xf4, 0x4a, 0xb0, 0x21, 0x27, 0x43, 0x34, 0x3d, 0x53, 0xb5, 0x3a, 0x39, 0x01, 0x02, + 0xa1, 0xf4, 0xcd, 0x2b, 0xbf, 0x64, 0x50, 0x34, 0x04, 0x1f, 0x45, 0x88, 0x61, 0xe6, 0x34, 0x21, + 0x6b, 0xca, 0x39, 0x9d, 0xb3, 0x4b, 0x6a, 0xec, 0x1e, 0x64, 0x4d, 0xbd, 0x0a, 0x4a, 0x0d, 0x1c, + 0x41, 0xda, 0x49, 0x10, 0xd3, 0x12, 0x01, 0x92, 0x21, 0x09, 0x38, 0x02, 0x80, 0xc5, 0xf0, 0x32, + 0x72, 0xc4, 0x31, 0x50, 0x9e, 0x51, 0x42, 0x92, 0x16, 0x6f, 0xa6, 0x2d, 0xde, 0x3c, 0x4f, 0xcf, + 0x88, 0xc3, 0x82, 0x10, 0xf2, 0xe1, 0x3f, 0xaa, 0x9a, 0x5d, 0x94, 0x7e, 0xc2, 0xa2, 0x3f, 0x00, + 0x4b, 0xad, 0xa8, 0x41, 0x22, 0x0f, 0x47, 0xbe, 0x13, 0x23, 0x8a, 0x89, 0x57, 0x9e, 0x95, 0x54, + 0x1b, 0xd7, 0xa8, 0xea, 0xea, 0x34, 0x49, 0x98, 0x7e, 0x25, 0x98, 0x16, 0x33, 0xe7, 0x33, 0xe9, + 0xab, 0x7f, 0x1f, 0xe8, 0xae, 0xdb, 0x96, 0x92, 0x48, 0x8b, 0xa7, 0x8c, 0xb7, 0x86, 0x67, 0x5c, + 0x72, 0xdd, 0xf6, 0x79, 0xe2, 0xad, 0x28, 0x7f, 0x0c, 0xd6, 0x39, 0x85, 0x11, 0xbb, 0x40, 0xf4, + 0x2a, 0x6f, 0x61, 0x78, 0xde, 0xb5, 0x94, 0xa3, 0x97, 0xfc, 0x1e, 0xd8, 0xca, 0x3a, 0x33, 0x45, + 0x1e, 0x66, 0x9c, 0xe2, 0x46, 0x4b, 0x6e, 0xba, 0x74, 0xdb, 0x94, 0x8b, 0x72, 0x11, 0x54, 0x52, + 0x9c, 0xdd, 0x03, 0xfb, 0xb6, 0x42, 0xe9, 0xa7, 0xe0, 0x15, 0xb9, 0x4d, 0x99, 0x10, 0xe7, 0xf4, + 0x30, 0xc9, 0xd0, 0x21, 0x66, 0x4c, 0xb0, 0x81, 0x2d, 0x6d, 0x67, 0xca, 0xde, 0x4e, 0xb0, 0x67, + 0x88, 0xd6, 0x73, 0xc8, 0xf3, 0x1c, 0x50, 0xdf, 0x05, 0x7a, 0x13, 0x33, 0x4e, 0x28, 0x76, 0x61, + 0xe0, 0xa0, 0x88, 0x53, 0x8c, 0x58, 0xb9, 0x24, 0xdd, 0x97, 0xbb, 0x96, 0x77, 0x12, 0x83, 0x7e, + 0x1f, 0x6c, 0xdf, 0x18, 0xd4, 0x71, 0x9b, 0x30, 0x8a, 0x50, 0x50, 0x9e, 0x93, 0xa9, 0x54, 0xbd, + 0x1b, 0x62, 0x1e, 0x25, 0x30, 0x7d, 0x05, 0xcc, 0x70, 0x12, 0x3b, 0x0f, 0xca, 0xf3, 0x5b, 0xda, + 0xce, 0xbc, 0x3d, 0xcd, 0x49, 0xfc, 0x40, 0x7f, 0x03, 0xac, 0xb6, 0x61, 0x80, 0x3d, 0xc8, 0x09, + 0x65, 0x4e, 0x4c, 0x2e, 0x11, 0x75, 0x5c, 0x18, 0x97, 0x17, 0x24, 0x46, 0xef, 0xda, 0xce, 0x84, + 0xe9, 0x08, 0xc6, 0xfa, 0x6d, 0xb0, 0x9c, 0x8d, 0x3a, 0x0c, 0x71, 0x09, 0x5f, 0x94, 0xf0, 0xc5, + 0xcc, 0xf0, 0x10, 0x71, 0x81, 0xdd, 0x04, 0x45, 0x18, 0x04, 0xe4, 0x32, 0xc0, 0x8c, 0x97, 0x97, + 0xb6, 0xa6, 0x76, 0x8a, 0x76, 0x77, 0x40, 0x37, 0x40, 0xc1, 0x43, 0x51, 0x47, 0x1a, 0x97, 0xa5, + 0x31, 0x7b, 0xee, 0xed, 0x3a, 0xfa, 0xd0, 0x5d, 0xe7, 0x5a, 0xab, 0x78, 0x19, 0xbc, 0xd4, 0xa7, + 0x1d, 0x64, 0xed, 0xe2, 0x8f, 0x1a, 0xd0, 0x73, 0x76, 0x1b, 0x85, 0xa4, 0x0d, 0x83, 0x41, 0xdd, + 0xe2, 0x00, 0x14, 0x99, 0x28, 0xa3, 0xdc, 0x9f, 0x93, 0x23, 0xec, 0xcf, 0x82, 0x70, 0x93, 0xdb, + 0xb3, 0x27, 0xb7, 0xa9, 0xf1, 0x73, 0xdb, 0x04, 0xc6, 0x75, 0xed, 0x59, 0x6a, 0x7f, 0xd0, 0xc0, + 0x9a, 0x30, 0x37, 0x61, 0xe4, 0x23, 0x1b, 0x5d, 0x42, 0xea, 0xd5, 0x51, 0x44, 0x42, 0xa6, 0xd7, + 0xc0, 0xbc, 0x27, 0xff, 0x39, 0x9c, 0x88, 0x2b, 0x4f, 0x59, 0x93, 0xc5, 0x2f, 0x25, 0x83, 0xe7, + 0xe4, 0xc0, 0xf3, 0xf4, 0x1d, 0xb0, 0xd4, 0xc5, 0x50, 0x41, 0x2d, 0xb2, 0x15, 0xb0, 0x85, 0x14, + 0x26, 0x03, 0xfe, 0xf7, 0xb2, 0xa9, 0xca, 0x63, 0xfd, 0xba, 0xdc, 0x2c, 0xa1, 0x0f, 0x34, 0x50, + 0x38, 0x61, 0xfe, 0x69, 0xcc, 0x8f, 0xa3, 0xff, 0xd3, 0x85, 0x6e, 0xbf, 0x90, 0x9e, 0xb0, 0x35, + 0x1d, 0x2c, 0xa5, 0x62, 0x32, 0x85, 0x18, 0x14, 0x93, 0xb1, 0xd3, 0x16, 0xff, 0x5f, 0x28, 0xcc, + 0x85, 0x5f, 0x01, 0xcb, 0x59, 0xa8, 0x2c, 0xfe, 0x13, 0x4d, 0x5e, 0x14, 0xc5, 0xe6, 0x53, 0x9a, + 0x8f, 0x48, 0xa8, 0xba, 0x80, 0x0d, 0x39, 0xba, 0x1e, 0x58, 0x1b, 0xb2, 0x34, 0xf9, 0x64, 0x26, + 0x7b, 0x93, 0xb9, 0x0f, 0xa6, 0x29, 0xe4, 0x48, 0x4d, 0xfd, 0x5d, 0xb1, 0xde, 0xff, 0xfe, 0xb4, + 0xfa, 0x52, 0x32, 0xfd, 0xcc, 0x7b, 0x64, 0x62, 0x62, 0x85, 0x90, 0x37, 0xcd, 0xef, 0x21, 0x1f, + 0xba, 0x9d, 0x3a, 0x72, 0x3f, 0xfd, 0x78, 0x17, 0xa8, 0xd5, 0x51, 0x47, 0xee, 0x6f, 0x3f, 0x7b, + 0x7c, 0x5b, 0xb3, 0x25, 0x47, 0x2e, 0xbf, 0x57, 0xc1, 0x2b, 0x83, 0x32, 0xc9, 0x52, 0xfe, 0xcb, + 0xa4, 0xbc, 0x0b, 0x64, 0x37, 0x46, 0xe2, 0xe1, 0x0b, 0x71, 0xf1, 0x12, 0xbd, 0x76, 0x15, 0xcc, + 0x70, 0xcc, 0x03, 0xa4, 0xca, 0x9f, 0x3c, 0xe8, 0x5b, 0xa0, 0xe4, 0x21, 0xe6, 0x52, 0x1c, 0xcb, + 0x73, 0x20, 0xc9, 0x26, 0x3f, 0xd4, 0x93, 0xec, 0x54, 0x6f, 0xb2, 0x59, 0x0f, 0x9d, 0x1e, 0xa2, + 0x87, 0xce, 0x8c, 0xd6, 0x43, 0x67, 0x87, 0xe8, 0xa1, 0xb7, 0x06, 0xf5, 0xd0, 0xc2, 0xa0, 0x1e, + 0x5a, 0x1c, 0x7a, 0x67, 0xd6, 0xb6, 0x41, 0xf5, 0x86, 0x92, 0xa6, 0x65, 0xdf, 0xfb, 0x73, 0x09, + 0x4c, 0x9d, 0x30, 0x5f, 0xff, 0xa5, 0x06, 0x96, 0xaf, 0xbf, 0x6d, 0x7d, 0x7d, 0xa8, 0xab, 0x5e, + 0xbf, 0x57, 0x1a, 0xe3, 0x60, 0x6c, 0xd7, 0x54, 0x9b, 0xfe, 0x7b, 0x0d, 0x18, 0x03, 0x5e, 0x85, + 0x0e, 0x87, 0x8d, 0x70, 0x33, 0x87, 0x71, 0xff, 0xc5, 0x39, 0x06, 0xc8, 0xed, 0x79, 0x99, 0x19, + 0x53, 0x6e, 0x9e, 0x63, 0x5c, 0xb9, 0xfd, 0x5e, 0x11, 0xf4, 0x5f, 0x68, 0x60, 0xe9, 0xda, 0xed, + 0xfa, 0x6b, 0xc3, 0x06, 0xb8, 0xea, 0x69, 0x7c, 0x6b, 0x5c, 0xcf, 0x4c, 0xd0, 0x07, 0x1a, 0x58, + 0xbc, 0x7a, 0x7e, 0xbf, 0x35, 0x2a, 0xab, 0x72, 0x34, 0xbe, 0x39, 0xa6, 0x63, 0xa6, 0xe6, 0x7d, + 0x0d, 0xcc, 0xf5, 0xbc, 0x3e, 0x7d, 0x75, 0x58, 0xc6, 0xbc, 0x97, 0xf1, 0xf6, 0x38, 0x5e, 0x99, + 0x88, 0x10, 0xcc, 0x24, 0xa7, 0xe4, 0xee, 0xb0, 0x34, 0x12, 0x6e, 0xbc, 0x39, 0x12, 0x3c, 0x0b, + 0x17, 0x83, 0x59, 0x75, 0xe6, 0x99, 0x23, 0x10, 0x9c, 0xb6, 0xb8, 0x71, 0x77, 0x34, 0x7c, 0x16, + 0xf1, 0x77, 0x1a, 0xd8, 0xb8, 0xf9, 0x94, 0x1b, 0xba, 0x87, 0xdc, 0x48, 0x61, 0x1c, 0xbf, 0x30, + 0x45, 0xa6, 0xf5, 0xd7, 0x1a, 0x58, 0xed, 0x7b, 0x3c, 0xbd, 0x3d, 0xea, 0x5a, 0xcb, 0x7b, 0x1b, + 0xf5, 0x17, 0xf1, 0x4e, 0xc5, 0x19, 0x33, 0x3f, 0x15, 0xa7, 0xef, 0xe1, 0x0f, 0x9f, 0x3c, 0xab, + 0x68, 0x9f, 0x3c, 0xab, 0x68, 0xff, 0x7c, 0x56, 0xd1, 0x3e, 0x7c, 0x5e, 0x99, 0xf8, 0xe4, 0x79, + 0x65, 0xe2, 0x6f, 0xcf, 0x2b, 0x13, 0x3f, 0xfa, 0x86, 0x8f, 0x79, 0xb3, 0xd5, 0x30, 0x5d, 0x12, + 0xaa, 0x4f, 0x85, 0x56, 0x37, 0xee, 0x6e, 0xf6, 0xa5, 0xaf, 0xfd, 0xa6, 0xf5, 0x5e, 0xef, 0xe7, + 0x3e, 0xf9, 0x79, 0xa4, 0x31, 0x2b, 0xaf, 0xc4, 0x5f, 0xf9, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xf3, 0x10, 0x7a, 0x7e, 0x6a, 0x15, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -926,6 +1418,10 @@ type MsgClient interface { ConsumerAddition(ctx context.Context, in *MsgConsumerAddition, opts ...grpc.CallOption) (*MsgConsumerAdditionResponse, error) ConsumerRemoval(ctx context.Context, in *MsgConsumerRemoval, opts ...grpc.CallOption) (*MsgConsumerRemovalResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + OptIn(ctx context.Context, in *MsgOptIn, opts ...grpc.CallOption) (*MsgOptInResponse, error) + OptOut(ctx context.Context, in *MsgOptOut, opts ...grpc.CallOption) (*MsgOptOutResponse, error) + SetConsumerCommissionRate(ctx context.Context, in *MsgSetConsumerCommissionRate, opts ...grpc.CallOption) (*MsgSetConsumerCommissionRateResponse, error) + ConsumerModification(ctx context.Context, in *MsgConsumerModification, opts ...grpc.CallOption) (*MsgConsumerModificationResponse, error) } type msgClient struct { @@ -990,14 +1486,54 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } -// MsgServer is the server API for Msg service. -type MsgServer interface { - AssignConsumerKey(context.Context, *MsgAssignConsumerKey) (*MsgAssignConsumerKeyResponse, error) - SubmitConsumerMisbehaviour(context.Context, *MsgSubmitConsumerMisbehaviour) (*MsgSubmitConsumerMisbehaviourResponse, error) - SubmitConsumerDoubleVoting(context.Context, *MsgSubmitConsumerDoubleVoting) (*MsgSubmitConsumerDoubleVotingResponse, error) - ConsumerAddition(context.Context, *MsgConsumerAddition) (*MsgConsumerAdditionResponse, error) - ConsumerRemoval(context.Context, *MsgConsumerRemoval) (*MsgConsumerRemovalResponse, error) - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +func (c *msgClient) OptIn(ctx context.Context, in *MsgOptIn, opts ...grpc.CallOption) (*MsgOptInResponse, error) { + out := new(MsgOptInResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/OptIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) OptOut(ctx context.Context, in *MsgOptOut, opts ...grpc.CallOption) (*MsgOptOutResponse, error) { + out := new(MsgOptOutResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/OptOut", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SetConsumerCommissionRate(ctx context.Context, in *MsgSetConsumerCommissionRate, opts ...grpc.CallOption) (*MsgSetConsumerCommissionRateResponse, error) { + out := new(MsgSetConsumerCommissionRateResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/SetConsumerCommissionRate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ConsumerModification(ctx context.Context, in *MsgConsumerModification, opts ...grpc.CallOption) (*MsgConsumerModificationResponse, error) { + out := new(MsgConsumerModificationResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/ConsumerModification", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + AssignConsumerKey(context.Context, *MsgAssignConsumerKey) (*MsgAssignConsumerKeyResponse, error) + SubmitConsumerMisbehaviour(context.Context, *MsgSubmitConsumerMisbehaviour) (*MsgSubmitConsumerMisbehaviourResponse, error) + SubmitConsumerDoubleVoting(context.Context, *MsgSubmitConsumerDoubleVoting) (*MsgSubmitConsumerDoubleVotingResponse, error) + ConsumerAddition(context.Context, *MsgConsumerAddition) (*MsgConsumerAdditionResponse, error) + ConsumerRemoval(context.Context, *MsgConsumerRemoval) (*MsgConsumerRemovalResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + OptIn(context.Context, *MsgOptIn) (*MsgOptInResponse, error) + OptOut(context.Context, *MsgOptOut) (*MsgOptOutResponse, error) + SetConsumerCommissionRate(context.Context, *MsgSetConsumerCommissionRate) (*MsgSetConsumerCommissionRateResponse, error) + ConsumerModification(context.Context, *MsgConsumerModification) (*MsgConsumerModificationResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1022,6 +1558,18 @@ func (*UnimplementedMsgServer) ConsumerRemoval(ctx context.Context, req *MsgCons func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) OptIn(ctx context.Context, req *MsgOptIn) (*MsgOptInResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OptIn not implemented") +} +func (*UnimplementedMsgServer) OptOut(ctx context.Context, req *MsgOptOut) (*MsgOptOutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OptOut not implemented") +} +func (*UnimplementedMsgServer) SetConsumerCommissionRate(ctx context.Context, req *MsgSetConsumerCommissionRate) (*MsgSetConsumerCommissionRateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetConsumerCommissionRate not implemented") +} +func (*UnimplementedMsgServer) ConsumerModification(ctx context.Context, req *MsgConsumerModification) (*MsgConsumerModificationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConsumerModification not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1135,6 +1683,78 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_OptIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgOptIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).OptIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/OptIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).OptIn(ctx, req.(*MsgOptIn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_OptOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgOptOut) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).OptOut(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/OptOut", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).OptOut(ctx, req.(*MsgOptOut)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SetConsumerCommissionRate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetConsumerCommissionRate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetConsumerCommissionRate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/SetConsumerCommissionRate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetConsumerCommissionRate(ctx, req.(*MsgSetConsumerCommissionRate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ConsumerModification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgConsumerModification) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ConsumerModification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/ConsumerModification", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ConsumerModification(ctx, req.(*MsgConsumerModification)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "interchain_security.ccv.provider.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -1163,6 +1783,22 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "OptIn", + Handler: _Msg_OptIn_Handler, + }, + { + MethodName: "OptOut", + Handler: _Msg_OptOut_Handler, + }, + { + MethodName: "SetConsumerCommissionRate", + Handler: _Msg_SetConsumerCommissionRate_Handler, + }, + { + MethodName: "ConsumerModification", + Handler: _Msg_ConsumerModification_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/provider/v1/tx.proto", @@ -1472,7 +2108,46 @@ func (m *MsgConsumerAddition) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Authority) i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) i-- - dAtA[i] = 0x6a + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + if len(m.Denylist) > 0 { + for iNdEx := len(m.Denylist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denylist[iNdEx]) + copy(dAtA[i:], m.Denylist[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denylist[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + } + if len(m.Allowlist) > 0 { + for iNdEx := len(m.Allowlist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Allowlist[iNdEx]) + copy(dAtA[i:], m.Allowlist[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Allowlist[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + } + if m.ValidatorSetCap != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ValidatorSetCap)) + i-- + dAtA[i] = 0x78 + } + if m.ValidatorsPowerCap != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ValidatorsPowerCap)) + i-- + dAtA[i] = 0x70 + } + if m.Top_N != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Top_N)) + i-- + dAtA[i] = 0x68 } if len(m.DistributionTransmissionChannel) > 0 { i -= len(m.DistributionTransmissionChannel) @@ -1726,84 +2401,388 @@ func (m *MsgChangeRewardDenomsResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *MsgOptIn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgAssignConsumerKey) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgOptIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgOptIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ProviderAddr) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.ConsumerKey) > 0 { + i -= len(m.ConsumerKey) + copy(dAtA[i:], m.ConsumerKey) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConsumerKey))) + i-- + dAtA[i] = 0x1a } - l = len(m.ConsumerKey) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.ProviderAddr) > 0 { + i -= len(m.ProviderAddr) + copy(dAtA[i:], m.ProviderAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.ProviderAddr))) + i-- + dAtA[i] = 0x12 } - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + 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] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgAssignConsumerKeyResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgOptInResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgOptInResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgOptInResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgSubmitConsumerMisbehaviour) Size() (n int) { - if m == nil { - return 0 +func (m *MsgOptOut) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgOptOut) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgOptOut) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Submitter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.ProviderAddr) > 0 { + i -= len(m.ProviderAddr) + copy(dAtA[i:], m.ProviderAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.ProviderAddr))) + i-- + dAtA[i] = 0x12 } - if m.Misbehaviour != nil { - l = m.Misbehaviour.Size() - n += 1 + l + sovTx(uint64(l)) + 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] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *MsgSubmitConsumerMisbehaviourResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgOptOutResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *MsgOptOutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgOptOutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgSubmitConsumerDoubleVoting) Size() (n int) { - if m == nil { - return 0 +func (m *MsgSetConsumerCommissionRate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - l = len(m.Submitter) + return dAtA[:n], nil +} + +func (m *MsgSetConsumerCommissionRate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetConsumerCommissionRate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Rate.Size() + i -= size + if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + 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 + } + if len(m.ProviderAddr) > 0 { + i -= len(m.ProviderAddr) + copy(dAtA[i:], m.ProviderAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.ProviderAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetConsumerCommissionRateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetConsumerCommissionRateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetConsumerCommissionRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgConsumerModification) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgConsumerModification) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgConsumerModification) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0x4a + } + if len(m.Denylist) > 0 { + for iNdEx := len(m.Denylist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denylist[iNdEx]) + copy(dAtA[i:], m.Denylist[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denylist[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } + if len(m.Allowlist) > 0 { + for iNdEx := len(m.Allowlist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Allowlist[iNdEx]) + copy(dAtA[i:], m.Allowlist[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Allowlist[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if m.ValidatorSetCap != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ValidatorSetCap)) + i-- + dAtA[i] = 0x30 + } + if m.ValidatorsPowerCap != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ValidatorsPowerCap)) + i-- + dAtA[i] = 0x28 + } + if m.Top_N != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Top_N)) + 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.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintTx(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgConsumerModificationResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgConsumerModificationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgConsumerModificationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgAssignConsumerKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ProviderAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAssignConsumerKeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitConsumerMisbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Misbehaviour != nil { + l = m.Misbehaviour.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitConsumerMisbehaviourResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitConsumerDoubleVoting) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Submitter) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1893,9 +2872,30 @@ func (m *MsgConsumerAddition) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if m.Top_N != 0 { + n += 1 + sovTx(uint64(m.Top_N)) + } + if m.ValidatorsPowerCap != 0 { + n += 1 + sovTx(uint64(m.ValidatorsPowerCap)) + } + if m.ValidatorSetCap != 0 { + n += 1 + sovTx(uint64(m.ValidatorSetCap)) + } + if len(m.Allowlist) > 0 { + for _, s := range m.Allowlist { + l = len(s) + n += 2 + l + sovTx(uint64(l)) + } + } + if len(m.Denylist) > 0 { + for _, s := range m.Denylist { + l = len(s) + n += 2 + l + sovTx(uint64(l)) + } + } l = len(m.Authority) if l > 0 { - n += 1 + l + sovTx(uint64(l)) + n += 2 + l + sovTx(uint64(l)) } return n } @@ -1971,24 +2971,163 @@ func (m *MsgChangeRewardDenomsResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *MsgOptIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ProviderAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConsumerKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n } -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *MsgOptInResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n } -func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) 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 + +func (m *MsgOptOut) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ProviderAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgOptOutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSetConsumerCommissionRate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProviderAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Rate.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgSetConsumerCommissionRateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgConsumerModification) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Top_N != 0 { + n += 1 + sovTx(uint64(m.Top_N)) + } + if m.ValidatorsPowerCap != 0 { + n += 1 + sovTx(uint64(m.ValidatorsPowerCap)) + } + if m.ValidatorSetCap != 0 { + n += 1 + sovTx(uint64(m.ValidatorSetCap)) + } + if len(m.Allowlist) > 0 { + for _, s := range m.Allowlist { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.Denylist) > 0 { + for _, s := range m.Denylist { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgConsumerModificationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) 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++ @@ -3063,52 +4202,926 @@ func (m *MsgConsumerAddition) Unmarshal(dAtA []byte) error { if postIndex < 0 { return ErrInvalidLengthTx } - if postIndex > l { + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerRedistributionFraction = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerDistributionTransmission", wireType) + } + m.BlocksPerDistributionTransmission = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlocksPerDistributionTransmission |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) + } + m.HistoricalEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HistoricalEntries |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionTransmissionChannel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DistributionTransmissionChannel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Top_N", wireType) + } + m.Top_N = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Top_N |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsPowerCap", wireType) + } + m.ValidatorsPowerCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorsPowerCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetCap", wireType) + } + m.ValidatorSetCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorSetCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denylist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 18: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 *MsgConsumerAdditionResponse) Unmarshal(dAtA []byte) 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: MsgConsumerAdditionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConsumerAdditionResponse: 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 *MsgConsumerRemoval) Unmarshal(dAtA []byte) 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: MsgConsumerRemoval: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConsumerRemoval: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StopTime", 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.StopTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 *MsgConsumerRemovalResponse) Unmarshal(dAtA []byte) 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: MsgConsumerRemovalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgConsumerRemovalResponse: 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 *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) 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: MsgChangeRewardDenoms: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChangeRewardDenoms: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomsToAdd", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomsToAdd = append(m.DenomsToAdd, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomsToRemove", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomsToRemove = append(m.DenomsToRemove, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 *MsgChangeRewardDenomsResponse) Unmarshal(dAtA []byte) 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: MsgChangeRewardDenomsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChangeRewardDenomsResponse: 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 *MsgOptIn) Unmarshal(dAtA []byte) 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: MsgOptIn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgOptIn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProviderAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerKey = 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 *MsgOptInResponse) Unmarshal(dAtA []byte) 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: MsgOptInResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgOptInResponse: 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 *MsgOptOut) Unmarshal(dAtA []byte) 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 } - m.ConsumerRedistributionFraction = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerDistributionTransmission", wireType) - } - m.BlocksPerDistributionTransmission = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlocksPerDistributionTransmission |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) - } - m.HistoricalEntries = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HistoricalEntries |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - case 12: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgOptOut: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgOptOut: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistributionTransmissionChannel", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3136,11 +5149,11 @@ func (m *MsgConsumerAddition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DistributionTransmissionChannel = string(dAtA[iNdEx:postIndex]) + m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 13: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3168,7 +5181,7 @@ func (m *MsgConsumerAddition) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.ProviderAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3191,7 +5204,7 @@ func (m *MsgConsumerAddition) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConsumerAdditionResponse) Unmarshal(dAtA []byte) error { +func (m *MsgOptOutResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3214,10 +5227,10 @@ func (m *MsgConsumerAdditionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgConsumerAdditionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgOptOutResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConsumerAdditionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgOptOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3241,7 +5254,7 @@ func (m *MsgConsumerAdditionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConsumerRemoval) Unmarshal(dAtA []byte) error { +func (m *MsgSetConsumerCommissionRate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3264,15 +5277,15 @@ func (m *MsgConsumerRemoval) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgConsumerRemoval: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetConsumerCommissionRate: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConsumerRemoval: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetConsumerCommissionRate: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3300,13 +5313,13 @@ func (m *MsgConsumerRemoval) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ProviderAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StopTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3316,28 +5329,27 @@ func (m *MsgConsumerRemoval) 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 ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StopTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3365,7 +5377,9 @@ func (m *MsgConsumerRemoval) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3388,7 +5402,7 @@ func (m *MsgConsumerRemoval) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgConsumerRemovalResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSetConsumerCommissionRateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3411,10 +5425,10 @@ func (m *MsgConsumerRemovalResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgConsumerRemovalResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetConsumerCommissionRateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConsumerRemovalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetConsumerCommissionRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3438,7 +5452,7 @@ func (m *MsgConsumerRemovalResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { +func (m *MsgConsumerModification) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3461,15 +5475,15 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgChangeRewardDenoms: wiretype end group for non-group") + return fmt.Errorf("proto: MsgConsumerModification: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeRewardDenoms: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgConsumerModification: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomsToAdd", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3497,11 +5511,11 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DenomsToAdd = append(m.DenomsToAdd, string(dAtA[iNdEx:postIndex])) + m.Title = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomsToRemove", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3529,9 +5543,162 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DenomsToRemove = append(m.DenomsToRemove, string(dAtA[iNdEx:postIndex])) + m.Description = 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 Top_N", wireType) + } + m.Top_N = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Top_N |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsPowerCap", wireType) + } + m.ValidatorsPowerCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorsPowerCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetCap", wireType) + } + m.ValidatorSetCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorSetCap |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Allowlist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Allowlist = append(m.Allowlist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denylist", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denylist = append(m.Denylist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } @@ -3584,7 +5751,7 @@ func (m *MsgChangeRewardDenoms) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgChangeRewardDenomsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgConsumerModificationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3607,10 +5774,10 @@ func (m *MsgChangeRewardDenomsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgChangeRewardDenomsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgConsumerModificationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeRewardDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgConsumerModificationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index f7456c7e3b..a25cfe467e 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -11,7 +11,6 @@ import ( ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -53,6 +52,10 @@ type StakingKeeper interface { GetUnbondingDelegationsFromValidator(ctx context.Context, valAddr sdk.ValAddress) ([]stakingtypes.UnbondingDelegation, error) GetRedelegationsFromSrcValidator(ctx context.Context, valAddr sdk.ValAddress) ([]stakingtypes.Redelegation, error) GetUnbondingType(ctx context.Context, id uint64) (stakingtypes.UnbondingType, error) + MinCommissionRate(ctx context.Context) (math.LegacyDec, error) + GetUnbondingDelegationByUnbondingID(ctx context.Context, id uint64) (stakingtypes.UnbondingDelegation, error) + GetRedelegationByUnbondingID(ctx context.Context, id uint64) (stakingtypes.Redelegation, error) + GetValidatorByUnbondingID(ctx context.Context, id uint64) (stakingtypes.Validator, error) } // SlashingKeeper defines the contract expected to perform ccv slashing @@ -109,6 +112,8 @@ type ClientKeeper interface { // DistributionKeeper defines the expected interface of the distribution keeper type DistributionKeeper interface { FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error + GetCommunityTax(ctx context.Context) (math.LegacyDec, error) + AllocateTokensToValidator(ctx context.Context, validator stakingtypes.ValidatorI, reward sdk.DecCoins) error } // ConsumerHooks event hooks for newly bonded cross-chain validators @@ -134,7 +139,7 @@ type IBCTransferKeeper interface { Transfer(context.Context, *transfertypes.MsgTransfer) (*transfertypes.MsgTransferResponse, error) } -// IBCKeeper defines the expected interface needed for opening a +// IBCCoreKeeper defines the expected interface needed for opening a // channel type IBCCoreKeeper interface { ChannelOpenInit(