Skip to content

Commit

Permalink
feat!: Add support for priority validators (#2101)
Browse files Browse the repository at this point in the history
* Start adding priority validators

* Add new priority_validator field

* Added priority list to the PowerShapingParameters

* Add documentation for priority list

* Add priority list in local-testnet.sh

* Update .changelog/unreleased/features/provider/xxxx-priority-validators.md

Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com>

* Update x/ccv/provider/keeper/power_shaping.go

Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com>

* Update x/ccv/provider/keeper/power_shaping_test.go

Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com>

* Update x/ccv/provider/keeper/power_shaping_test.go

Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com>

* Update .changelog/unreleased/api-breaking/provider/xxxx-priority-validators.md

Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com>

* Fix typo in provider.proto

* Remove unnecessary priority list from test in steps_permissionless_ics.go

* Remove comment from grpc_query.go

* Add e2e test for priority list

* Improved e2e test

* Fixed some issues

* Refactored code logic

* Refactored code logic

* Renamed files

* Removed priority list from migrations.go

* Fixed bug for priority list

* Added priority list to e2e nightly tests

* Update tx.go

* Refactored TestCapValidatorSet

* Small fixes

* Small fixes

* Fix PartitionBasedOnPriorityList function

* Update contrib/local-testnet.sh

Co-authored-by: Marius Poke <marius.poke@posteo.de>

* Moved 2101-introduce-priority-validators.md into state-breaking

* Fixed TestGetConsumerChain

* Added test case in TestCapValidatorSet

* Revert changes made by the merge

* Removed changes from ADRs that were already implemented

* Added a comment in CapValidatorSet function

* Removed unnecessary imports

---------

Co-authored-by: kirdatatjana <kirda.tatjana@gmail.com>
Co-authored-by: kirdatatjana <116630536+kirdatatjana@users.noreply.github.com>
Co-authored-by: Marius Poke <marius.poke@posteo.de>
  • Loading branch information
4 people authored Oct 25, 2024
1 parent 0d6f75f commit dd09294
Show file tree
Hide file tree
Showing 28 changed files with 1,106 additions and 426 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Allow consumer chains to specify a list of priority validators that are included in the validator set before other validators are considered
([\#2101](https://github.com/cosmos/interchain-security/pull/2101))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Allow consumer chains to specify a list of priority validators that are included in the validator set before other validators are considered
([\#2101](https://github.com/cosmos/interchain-security/pull/2101))
17 changes: 17 additions & 0 deletions .github/workflows/nightly-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,22 @@ jobs:
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
partial-set-security-validators-prioritylisted-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 prioritylist
run: go run ./tests/e2e/... --tc partial-set-security-validators-prioritylisted
partial-set-security-modification-proposal:
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down Expand Up @@ -376,6 +392,7 @@ jobs:
- partial-set-security-validators-power-cap-test
- partial-set-security-validators-allowlisted-test
- partial-set-security-validators-denylisted-test
- partial-set-security-validators-prioritylisted-test
- partial-set-security-modification-proposal
- active-set-changes-test
- permissionless-basic-test
Expand Down
3 changes: 2 additions & 1 deletion contrib/local-testnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ tee ${PROV_NODE_DIR}/consumer_prop.json<<EOF
"allowlist": [],
"denylist": [],
"min_stake": 1000,
"allow_inactive_vals": true
"allow_inactive_vals": true,
"prioritylist": []
}
}
],
Expand Down
13 changes: 11 additions & 2 deletions docs/docs/build/modules/02-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ Format: `byte(37) | len(consumerId) | []byte(consumerId) | addr -> []byte{}`, wi

Format: `byte(40) | len(consumerId) | []byte(consumerId) -> uint64`

#### Prioritylist

`Prioritylist` is the list of provider validators that have priority to validate a given consumer chain.

Format: `byte(56) | len(consumerId) | []byte(consumerId) | addr -> []byte{}`, with `addr` the validator's consensus address on the provider chain.

### Validator Set Updates

#### ValidatorSetUpdateId
Expand Down Expand Up @@ -1089,6 +1095,7 @@ Output:
chains:
- allow_inactive_vals: true
allowlist: []
prioritylist: []
chain_id: pion-1
client_id: 07-tendermint-0
consumer_id: "0"
Expand Down Expand Up @@ -1554,6 +1561,7 @@ power_shaping_params:
top_N: 100
validator_set_cap: 0
validators_power_cap: 0
prioritylist: []
```

</details>
Expand Down Expand Up @@ -1679,8 +1687,9 @@ where `update-consumer-msg.json` contains:
"validator_set_cap": 50,
"allowlist":["cosmosvalcons1l9qq4m300z8c5ez86ak2mp8znftewkwgjlxh88"],
"denylist":[],
"min_stake": 1000,
"allow_inactive_vals":true
"min_stake": "1000",
"allow_inactive_vals":true,
"prioritylist":[]
},
"allowlisted_reward_denoms": {
"denoms": ["ibc/0025F8A87464A471E66B234C4F93AEC5B4DA3D42D7986451A059273426290DD5"]
Expand Down
4 changes: 3 additions & 1 deletion docs/docs/consumer-development/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ Example of power-shaping parameters:
// Corresponds to the minimal amount of (provider chain) stake required to validate on the consumer chain.
"min_stake": 0,
// Corresponds to whether inactive validators are allowed to validate the consumer chain.
"allow_inactive_vals": false
"allow_inactive_vals": false,
// Corresponds to a list of provider consensus addresses of validators that have priority
"prioritylist": [],
}
```

Expand Down
4 changes: 4 additions & 0 deletions docs/docs/features/power-shaping.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ This can be useful for chains that want to have a larger validator set than the
Consumer chains that enable this feature should strongly consider setting a minimum validator stake to ensure that only validators with some reputation/stake can validate the chain.
By default, this parameter is set to `false`, i.e., validators outside of the provider's active set are not eligible to opt in.

### Prioritylist

The consumer chain can specify a priority list of validators for participation in the validator set. Validators on the priority list are considered first when forming the consumer chain's validator set. If a priority list isn't set, the remaining slots are filled based on validator power.

## Setting Power Shaping Parameters

All the power shaping parameters can be set by the consumer chain in the `MsgCreateConsumer` or `MsgUpdateConsumer` messages.
Expand Down
Loading

0 comments on commit dd09294

Please sign in to comment.