Skip to content

Commit

Permalink
test: add E2E test for power-shaping features (backport #1853) (#1896)
Browse files Browse the repository at this point in the history
test: add E2E test for power-shaping features (#1853)

* added E2E tests

* Update tests/e2e/steps_partial_set_security.go

Co-authored-by: Philip Offtermatt <[email protected]>

* added to nightly tests

---------

Co-authored-by: Philip Offtermatt <[email protected]>
(cherry picked from commit a1557bb)

Co-authored-by: insumity <[email protected]>
  • Loading branch information
mergify[bot] and insumity authored May 17, 2024
1 parent e53b34c commit f4a9e20
Show file tree
Hide file tree
Showing 4 changed files with 1,028 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/nightly-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,102 @@ jobs:
go-version: "1.21" # 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.21"
- 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.
- 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.21"
- 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.
- 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.21"
- 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.
- 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.21"
- 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.
- 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.21"
- 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.
- 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.21"
- 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.
- name: E2E partial set security denylist
run: go run ./tests/e2e/... --tc partial-set-security-validators-denylisted

nightly-test-fail:
needs:
Expand All @@ -193,6 +289,12 @@ 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:
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ type SubmitConsumerAdditionProposalAction struct {
InitialHeight clienttypes.Height
DistributionChannel string
TopN uint32
ValidatorsPowerCap uint32
ValidatorSetCap uint32
Allowlist []string
Denylist []string
}

func (tr TestConfig) submitConsumerAdditionProposal(
Expand All @@ -287,6 +291,10 @@ func (tr TestConfig) submitConsumerAdditionProposal(
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)
Expand Down
26 changes: 26 additions & 0 deletions tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,30 @@ var stepChoices = map[string]StepChoice{
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 {
Expand Down Expand Up @@ -254,6 +278,8 @@ func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet, providerVe
"democracy-reward", "democracy",
"slash-throttle", "consumer-double-sign", "consumer-misbehaviour",
"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")
Expand Down
Loading

0 comments on commit f4a9e20

Please sign in to comment.