-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standalone to consumer changeover - recycle existing transfer channel (…
…#832) * on-chain upgrade to consumer chain wip * add preCCV store and use it on democracy staking * add TODOs and one more packet possibility * status update * Resolve hermes start issue for trusted validator set by changing revision height * remove intermediary logs * remove further unused codebase * updates for endblocker test, existing test fixes, get last validators * update for slashing sovereign validators for the fault made before consumer chain upgrade height * resolve comments on github and slack communication * update sovereign app to use v4 ibc from v3 & resolve consumer module merge conflict fix issue * Update app/sovereign/upgrades/v3/upgrades.go Co-authored-by: yaruwangway <69694322+yaruwangway@users.noreply.github.com> * rm sovereign chain and tests. Will be replaced by simapp and integration tests * duplicate module name * add comment * small rename * remove democracy staking changes * consumer ccv beginblock, endblock, and initgenesis order shouldn't matter * add mock calls to compile * adjust tests for new keeper field * add registerDemocConsumer method * split out preCCV flag and initial valset * cleanup consumer module * cleanup * more cleanup * temp changes to validators.go * comment out test * rm bad code from merge * comment * Update app.go * UTs for CRUD * UTs for keys * use make for mocks * todo * changeover method and test * resolve #783 * comment * comments * add appropriate TODOs, restore changes to main * final nits before non-draft * comment on ChangeoverToConsumer * more clear comment * small comment change * update InitGenesis comment * sovereign -> standalone * missed a file * builds now * update comment after debug * ChangeoverIsComplete method * small refactors, comments, slash and jail code * naming refactor * fix last standalone height * Update module.go * needed refactors * rm unneeded diffs * two UTs * sanity check integration test * gofumpt * last standalone height -> init genesis height * wiring * integration test and refactor to enable it * sanity check * Update changeover.go * Use ValidatorUpdateDelay * for loop * fix key name * Update x/ccv/consumer/keeper/changeover.go Co-authored-by: Simon Noetzlin <simon.ntz@gmail.com> * Update x/ccv/consumer/keeper/validators.go Co-authored-by: Simon Noetzlin <simon.ntz@gmail.com> * fix test * rm dup method * Update keys_test.go --------- Co-authored-by: jstr1121 <jun@stridelabs.co> Co-authored-by: jstr1121 <118450565+jstr1121@users.noreply.github.com> Co-authored-by: yaruwangway <69694322+yaruwangway@users.noreply.github.com> Co-authored-by: Simon Noetzlin <simon.ntz@gmail.com>
- Loading branch information
1 parent
69c01da
commit 952e2fe
Showing
14 changed files
with
180 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package integration | ||
|
||
import ( | ||
transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" | ||
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" | ||
) | ||
|
||
func (suite *CCVTestSuite) TestRecycleTransferChannel() { | ||
consumerKeeper := suite.consumerApp.GetConsumerKeeper() | ||
|
||
// Only create a connection between consumer and provider | ||
suite.coordinator.CreateConnections(suite.path) | ||
|
||
// Confirm transfer channel has not been persisted | ||
transChan := consumerKeeper.GetDistributionTransmissionChannel(suite.consumerCtx()) | ||
suite.Require().Empty(transChan) | ||
|
||
// Create transfer channel manually | ||
distrTransferMsg := channeltypes.NewMsgChannelOpenInit( | ||
transfertypes.PortID, | ||
transfertypes.Version, | ||
channeltypes.UNORDERED, | ||
[]string{suite.path.EndpointA.ConnectionID}, | ||
transfertypes.PortID, | ||
"", // signer unused | ||
) | ||
resp, err := consumerKeeper.ChannelOpenInit(suite.consumerCtx(), distrTransferMsg) | ||
suite.Require().NoError(err) | ||
|
||
// Confirm transfer channel still not persisted | ||
transChan = consumerKeeper.GetDistributionTransmissionChannel(suite.consumerCtx()) | ||
suite.Require().Empty(transChan) | ||
|
||
// Setup state s.t. the consumer keeper emulates a consumer that was previously standalone | ||
consumerKeeper.MarkAsPrevStandaloneChain(suite.consumerCtx()) | ||
suite.Require().True(consumerKeeper.IsPrevStandaloneChain(suite.consumerCtx())) | ||
suite.consumerApp.GetConsumerKeeper().SetStandaloneTransferChannelID(suite.consumerCtx(), resp.ChannelId) | ||
|
||
// Now finish setting up CCV channel | ||
suite.ExecuteCCVChannelHandshake(suite.path) | ||
|
||
// Confirm transfer channel is now persisted with expected channel id from open init response | ||
transChan = consumerKeeper.GetDistributionTransmissionChannel(suite.consumerCtx()) | ||
suite.Require().Equal(resp.ChannelId, transChan) | ||
|
||
// Confirm channel exists | ||
found := consumerKeeper.TransferChannelExists(suite.consumerCtx(), transChan) | ||
suite.Require().True(found) | ||
|
||
// Sanity check, only two channels should exist, one transfer and one ccv | ||
channels := suite.consumerApp.GetIBCKeeper().ChannelKeeper.GetAllChannels(suite.consumerCtx()) | ||
suite.Require().Len(channels, 2) | ||
} |
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
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
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