|
4 | 4 | "time" |
5 | 5 |
|
6 | 6 | gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" |
| 7 | + clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" |
7 | 8 | ) |
8 | 9 |
|
9 | 10 | // start relayer so that all messages are relayed |
@@ -130,3 +131,65 @@ func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) [] |
130 | 131 |
|
131 | 132 | return s |
132 | 133 | } |
| 134 | + |
| 135 | +// ICS1: Re-adds a consumer chain that was previously removed, reusing the existing IBC connection. |
| 136 | +// This tests the connection reuse feature for standalone-to-consumer transitions. |
| 137 | +// The consumerName should match a previously removed consumer chain that still has an active IBC connection. |
| 138 | +func stepsReAddConsumerWithConnectionReuse(consumerName string, propNumber uint) []Step { |
| 139 | + s := []Step{ |
| 140 | + { |
| 141 | + Action: SubmitConsumerAdditionProposalAction{ |
| 142 | + Chain: ChainID("provi"), |
| 143 | + From: ValidatorID("alice"), |
| 144 | + Deposit: 10000001, |
| 145 | + ConsumerChain: ChainID(consumerName), |
| 146 | + SpawnTime: 0, |
| 147 | + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, |
| 148 | + TopN: 100, // All validators must validate (100% = Replicated Security) |
| 149 | + // ICS1: Reuse connection-0 that was created when the consumer was first added |
| 150 | + ConnectionId: "connection-0", |
| 151 | + }, |
| 152 | + State: State{ |
| 153 | + ChainID("provi"): ChainState{ |
| 154 | + // Don't check balances - they vary due to gas costs from previous operations |
| 155 | + Proposals: &map[uint]Proposal{ |
| 156 | + propNumber: ConsumerAdditionProposal{ |
| 157 | + Deposit: 10000001, |
| 158 | + Chain: ChainID(consumerName), |
| 159 | + SpawnTime: 0, |
| 160 | + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, |
| 161 | + Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), |
| 162 | + }, |
| 163 | + }, |
| 164 | + ProposedConsumerChains: &[]string{consumerName}, |
| 165 | + }, |
| 166 | + }, |
| 167 | + }, |
| 168 | + { |
| 169 | + Action: VoteGovProposalAction{ |
| 170 | + Chain: ChainID("provi"), |
| 171 | + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, |
| 172 | + Vote: []string{"yes", "yes", "yes"}, |
| 173 | + PropNumber: propNumber, |
| 174 | + }, |
| 175 | + State: State{ |
| 176 | + ChainID("provi"): ChainState{ |
| 177 | + Proposals: &map[uint]Proposal{ |
| 178 | + propNumber: ConsumerAdditionProposal{ |
| 179 | + Deposit: 10000001, |
| 180 | + Chain: ChainID(consumerName), |
| 181 | + SpawnTime: 0, |
| 182 | + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, |
| 183 | + Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), |
| 184 | + }, |
| 185 | + }, |
| 186 | + // Don't check balances - they vary due to gas costs from previous operations |
| 187 | + // Consumer chain is re-added |
| 188 | + ConsumerChains: &map[ChainID]bool{ChainID(consumerName): true}, |
| 189 | + }, |
| 190 | + }, |
| 191 | + }, |
| 192 | + } |
| 193 | + |
| 194 | + return s |
| 195 | +} |
0 commit comments