-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add an e2e test that reproduces the chain halt (#1942)
* Start writing e2e test with unjailing * Add e2e steps for too many validators bug * Fix test config and setup * Change test to use top N chain * Add comment for panic * Start cleaning up active/inactive vals e2e test * Revert change to StartChains * Revert changes to partial-set-security tests * Rename test case * Rename CLI flag for test case * Address comments * Add active set changes test to nightly runs * Fix merge in main.go
- Loading branch information
1 parent
8a8e7a0
commit 198a26f
Showing
4 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
package main | ||
|
||
import clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" | ||
|
||
// stepsActiveSetChanges starts a top N provider chain and causes a change in the active set | ||
func stepsActiveSetChanges() []Step { | ||
s := []Step{ | ||
// === setup provider chain, consumer chain with top N = 100, and start IBC connections === | ||
{ | ||
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: 700000000, Allocation: 10000000000}, | ||
}, | ||
}, | ||
State: State{ | ||
ChainID("provi"): ChainState{ | ||
ValPowers: &map[ValidatorID]uint{ | ||
ValidatorID("alice"): 0, // MaxValidators is set to 2, so alice is not part of the validator set | ||
ValidatorID("bob"): 200, | ||
ValidatorID("carol"): 700, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Action: SubmitConsumerAdditionProposalAction{ | ||
Chain: ChainID("provi"), | ||
From: ValidatorID("alice"), | ||
Deposit: 10000001, | ||
ConsumerChain: ChainID("consu"), | ||
SpawnTime: 0, | ||
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, | ||
TopN: 100, | ||
}, | ||
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"): {}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Action: VoteGovProposalAction{ | ||
Chain: ChainID("provi"), | ||
From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, | ||
Vote: []string{"yes", "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: 700000000, 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{}, | ||
}, | ||
{ | ||
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{}, | ||
}, | ||
// === setup ends, ready for the actual test === | ||
// bob incurs downtime on the provider and gets jailed | ||
{ | ||
Action: DowntimeSlashAction{ | ||
Chain: ChainID("provi"), | ||
Validator: ValidatorID("bob"), | ||
}, | ||
State: State{ | ||
ChainID("provi"): ChainState{ | ||
ValPowers: &map[ValidatorID]uint{ | ||
ValidatorID("alice"): 100, // alice goes into the active set | ||
ValidatorID("bob"): 0, | ||
ValidatorID("carol"): 700, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
return s | ||
} |