Skip to content

Commit

Permalink
fix(sequencer, lightclient): do not prevent unbond when canonical cli…
Browse files Browse the repository at this point in the history
…ent not found (#1630)
  • Loading branch information
danwt authored Dec 7, 2024
1 parent 0a5b253 commit 00799a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion x/lightclient/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ func NewKeeper(
func (k Keeper) CanUnbond(ctx sdk.Context, seq sequencertypes.Sequencer) error {
client, ok := k.GetCanonicalClient(ctx, seq.RollappId)
if !ok {
return errorsmod.Wrap(sequencertypes.ErrUnbondNotAllowed, "no canonical client")
// It doesn't make sense to prevent unbonding here. If there is no canonical client, then
// there can have been no fraud that needs to be checked.
// Moreover, if we did prevent unbonding, it would lead to awkward situations where non proposer
// sequencers of early stage rollapps can't unbond, when the proposer is not doing his job.
return nil
}
rng := collections.NewSuperPrefixedTripleRange[string, string, uint64](seq.Address, client)
return k.headerSigners.Walk(ctx, rng, func(key collections.Triple[string, string, uint64]) (stop bool, err error) {
Expand Down
2 changes: 0 additions & 2 deletions x/sequencer/keeper/msg_server_kick_proposer_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package keeper_test

import (
rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types"
"github.com/dymensionxyz/dymension/v3/x/sequencer/types"
"github.com/dymensionxyz/gerr-cosmos/gerrc"
"github.com/dymensionxyz/sdk-utils/utils/utest"
)

func (s *SequencerTestSuite) TestKickProposerBasicFlow() {
s.App.RollappKeeper.SetHooks(rollapptypes.NewMultiRollappHooks(s.k().RollappHooks()))
ra := s.createRollapp()
seqAlice := s.createSequencerWithBond(s.Ctx, ra.RollappId, alice, bond)
s.Require().True(s.k().IsProposer(s.Ctx, seqAlice))
Expand Down
6 changes: 5 additions & 1 deletion x/sequencer/keeper/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ func (s *SequencerTestSuite) SetupTest() {

// Overwrite to exclude any unblockers set by default in apptesting, to ensure
// we are only testing our logic.
s.k().SetUnbondBlockers()
s.k().SetUnbondBlockers(
s.App.LightClientKeeper,
s.App.RollappKeeper,
)
s.App.RollappKeeper.SetHooks(rollapptypes.NewMultiRollappHooks(s.k().RollappHooks()))
}

func (s *SequencerTestSuite) seq(pk cryptotypes.PubKey) types.Sequencer {
Expand Down

0 comments on commit 00799a0

Please sign in to comment.