Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add E2E test for power-shaping features (backport #1853) #1896

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading