-
Notifications
You must be signed in to change notification settings - Fork 138
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
remove unnecessary parts of app.go in consumer and provider #98
Conversation
Close #65 * Update the CCV slashing logic to handle double-signing evidences. * Add `InfractionType` enum to the `SlashPacketData` fields * Use `InfractionType` enum to distinguish between downtime and double-signing infractions in the logic * Use the provider chain slash fraction and jail duration parameters * Change the evidence keeper instantiation in app.go to use the CCV module instead of the staking module
I think we can add the |
Do we need the |
@mpoke , genutil is used in creating genesis files for the blockchain afaiu. I think it's probably important to keep. It's necessary for a certain type of network upgrade and is also valuable for data since you can essentially dump the entire state of the blockchain with that command. We should try to preserve it. |
Strange though, this means that the Still I don't know why
|
Overall this PR looks good to me. Only thing I'll mention is that we should also remove this testing function It's nice to keep the ModuleManager (MM) exposed within the app.go on the provider chain so we can disable distribution on the provider chain to check consumer funds received on the provider chain. |
…urity into okwme/app-specific
… renamed consumer Keeper keys to match Staking Keeper
ok so the current problem has to do with making all the places in the consumer module that looks for The issue now is that the IBC testing framework expects a real functioning staking keeper in order to run. One solution was to try implementing all of the methods within the real So instead I went back and realized that the part of the
since However this breaks all of the IBC test framework we're using for testing Interchain Security because the IBC test framework wants to generate a chain with a real validator set. Seems like even if we could get Not sure how to proceed, anyone have ideas? |
@@ -26,7 +30,7 @@ import ( | |||
type Keeper struct { | |||
storeKey sdk.StoreKey | |||
cdc codec.BinaryCodec | |||
paramSpace paramtypes.Subspace | |||
paramstore paramtypes.Subspace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paramSpace
and accountKeeper
were renamed to match the stakingKeeper's naming conventions
// TrackHistoricalInfo saves the latest historical-info and deletes the oldest | ||
// heights that are below pruning height | ||
func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { | ||
entryNum := 4 * 7 * 24 * 60 * 60 // 4 weeks (TODO: confirm safe limit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this use types.UnbondingTime
?
@@ -155,6 +155,8 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { | |||
blockHeight := uint64(ctx.BlockHeight()) | |||
vID := am.keeper.GetHeightValsetUpdateID(ctx, blockHeight) | |||
am.keeper.SetHeightValsetUpdateID(ctx, blockHeight+1, vID) | |||
am.keeper.TrackHistoricalInfo(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this allows us to satisfy the requirements of IBC in opening new connections from the consumer chain. We're now storing the val set at each block as well as the val set updates.
also should note that I merged in @sainoe 's PR (#97) to this one to resolve some of the other interface issues. his work is mostly present in this PR within |
feels like there is a bit of scope creep going on in this PR. Ill try to break out a few things into their own prs so we can merge in a timely fashion. |
|
||
// TODO: export ccv vals as GenesisValidators | ||
// WriteValidators returns a slice of bonded genesis validators. | ||
func WriteValidators(ctx sdk.Context, keeper keeper.Keeper) (vals []tmtypes.GenesisValidator, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mpoke any chance you can explain the reasoning for this todo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marbar3778 Not sure. The entire consumer chain restart is a bit fuzzy to me. IMO, there are two reasons to export the state of a consumer chain:
- To restart the chain as a normal chain. I'm not sure how that's going to work. The consumer chain doesn't have a staking module (I'm ignoring here the gov-staking module). Thus, the exported state will contain no staking state and it doesn't require any validator set. This means that to restart as a normal chain, the state needs to be extended with this information.
- To restart the chain still as a consumer chain. The CCV channel to the provided is part of the exported state. As long as the restart is quick enough so that the CCV channel doesn't timeout on the provider side, once the consumer chain is restarted, a relayer will relay all the pending VSC packets (with all the validator updates). The consumer needs though an initial validator set on which to apply all these updates. This initial validator set is the last validator set on the consumer, which can be retrieved from the CCV module, see
func (k Keeper) GetAllCCValidator(ctx sdk.Context) (validators []types.CrossChainValidator) {
with cosmos/cosmos-sdk#12181 being merged I think we can close this PR since the reliance on staking the struct is no longer there. |
closing in light of #120 |
In removing unnecessary parts of the two app.go files it became apparent that there was still a dependence in the Consumer Chain on the staking module. Consumer chain should not have a staking module (at least not until democracy is added back with the
ccv/staking
module in issue #89 ). It uses the Consumer Module to handle all staking module duties. As such it fulfills the staking module interface and works with slashing. However there are other modules on a consumer chain that consume the staking module and are not happy when you swap in the consumer module instead.IBCKeeper
can't acceptapp.ConsumerKeeper
in place ofapp.StakingKeeper
because it's missing the methodGetHistoricalInfo
app.ConsumerKeeper
is missingApplyAndReturnValidatorSetUpdates
in order to be used bygenutil
genutil
module should be removed from the consumer chain; the init val set comes always from the CCV module (seeInitGenesis
)slashing.NewAppModule()
without reason listeddistr.NewAppModule
without reason listedGetStakingKeeper
prepForZeroHeightGenesis
while trying to use theGetAllDelegations
,IterateRedelegations
,SetRedelegation
,IterateUnbondingDelegations
,SetUnbondingDelegation
,GetValidator
,SetValidator
andApplyAndReturnValidatorSetUpdates
methods ofstakingKeeper
(these may be unnecessary, do we need to export genesis on a child chain?)Some of these changes are already present in @sainoe 's #97 (which relies on cosmos/cosmos-sdk#11921).
this also removes the liquidity module from the child chain as it should not be considered part of a standard application. It could stay on the provider chain since gaia has it but should also probably just be removed.
Closes #58