Skip to content
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

feat(sequencer): Implement new create sequencer design #985

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ea2f559
Rework the sequencer registration flow
zale144 Jul 11, 2024
b3d11e2
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/979…
zale144 Jul 11, 2024
8d63ab5
Enable validation, fix tests, cleanup
zale144 Jul 11, 2024
22e584e
Add migration
zale144 Jul 11, 2024
49795ca
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/979…
zale144 Jul 16, 2024
99e4fc3
Add new fields to sequencer metadata
zale144 Jul 16, 2024
73738d8
Fix migration tests
zale144 Jul 16, 2024
5bc6fa6
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/979…
zale144 Jul 16, 2024
107010a
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/979…
zale144 Jul 16, 2024
c2f8e6a
Add update rollapp handling
zale144 Jul 17, 2024
4ef58fe
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/996…
zale144 Jul 17, 2024
d9d55ae
Add telegram and twitter handle fields to rollapp
zale144 Jul 17, 2024
91f5416
Merge branch 'zale144/996-update-rollapp-information' into zale144/97…
zale144 Jul 17, 2024
dc8d799
Fix upgrade protos
zale144 Jul 17, 2024
6010ac7
Remove security contact and identity
zale144 Jul 18, 2024
09ec1b2
feat(sequencer): Update sequencer information handling (#1000)
zale144 Jul 21, 2024
8780c79
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/979…
mtsitrin Jul 21, 2024
2112b76
PR comment fixes
zale144 Jul 22, 2024
b6e1664
Merge remote-tracking branch 'origin/zale144/979-new-create-sequencer…
zale144 Jul 22, 2024
39d9db0
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/979…
zale144 Jul 24, 2024
3f13455
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/979…
zale144 Jul 24, 2024
e96dfc3
Merge branch 'zale144/978-new-create-rollapp-design' into zale144/979…
zale144 Jul 24, 2024
d66f8e3
Fix tests, add more tests, PR fixes
zale144 Jul 24, 2024
b650d68
Add the sealed flag to rollapp, as a precondition for sequencer regis…
zale144 Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

- (rollapp) [#999](https://github.com/dymensionxyz/dymension/issues/999) Handle sequencer information updates.
- (rollapp) [#996](https://github.com/dymensionxyz/dymension/issues/996) Handle rollapp information updates.
- (sequencer) [#955](https://github.com/dymensionxyz/dymension/issues/979) Rework the sequencer registration flow.
- (app) [#972](https://github.com/dymensionxyz/dymension/pull/972) Refactor upgrade handlers.
- (delayedack) [#972](https://github.com/dymensionxyz/dymension/pull/972) Use pagination when deleting rollapp packets.
- (denommetadata) [#955](https://github.com/dymensionxyz/dymension/issues/955) Add IBC middleware to create denom metadata from rollapp, on IBC transfer.
Expand Down
62 changes: 35 additions & 27 deletions app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import (
"strings"

"github.com/cometbft/cometbft/libs/rand"
"github.com/cosmos/cosmos-sdk/crypto/types"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
sdk "github.com/cosmos/cosmos-sdk/types"
bankutil "github.com/cosmos/cosmos-sdk/x/bank/testutil"
"github.com/stretchr/testify/suite"

"github.com/dymensionxyz/dymension/v3/app"
"github.com/dymensionxyz/dymension/v3/testutil/sample"

rollappkeeper "github.com/dymensionxyz/dymension/v3/x/rollapp/keeper"
rollapptypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types"
sequencerkeeper "github.com/dymensionxyz/dymension/v3/x/sequencer/keeper"
Expand All @@ -31,16 +30,19 @@ type KeeperTestHelper struct {
Ctx sdk.Context
}

func (s *KeeperTestHelper) CreateDefaultRollapp() string {
return s.CreateRollappWithName(rand.Str(8))
func (s *KeeperTestHelper) CreateDefaultRollappWithProposer() (string, string) {
return s.CreateRollappWithNameWithProposer(rand.Str(8))
}

func (s *KeeperTestHelper) CreateRollappWithName(name string) string {
func (s *KeeperTestHelper) CreateRollappWithNameWithProposer(name string) (string, string) {
pubkey := ed25519.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())

alias := strings.NewReplacer("_", "", "-", "").Replace(name) // base it on rollappID to avoid alias conflicts
msgCreateRollapp := rollapptypes.MsgCreateRollapp{
Creator: alice,
RollappId: name,
InitialSequencerAddress: sample.AccAddress(),
InitialSequencerAddress: addr.String(),
Bech32Prefix: strings.ToLower(rand.Str(3)),
GenesisChecksum: "1234567890abcdefg",
Alias: alias,
Expand All @@ -60,31 +62,37 @@ func (s *KeeperTestHelper) CreateRollappWithName(name string) string {
msgServer := rollappkeeper.NewMsgServerImpl(*s.App.RollappKeeper)
_, err := msgServer.CreateRollapp(s.Ctx, &msgCreateRollapp)
s.Require().NoError(err)
return name

err = s.CreateSequencer(s.Ctx, name, pubkey)
s.Require().NoError(err)
return name, addr.String()
}

func (s *KeeperTestHelper) CreateDefaultSequencer(ctx sdk.Context, rollappId string) string {
pubkey1 := secp256k1.GenPrivKey().PubKey()
addr1 := sdk.AccAddress(pubkey1.Address())
pkAny1, err := codectypes.NewAnyWithValue(pubkey1)
s.Require().Nil(err)
func (s *KeeperTestHelper) CreateDefaultSequencer(ctx sdk.Context, rollappId string) (string, error) {
pubkey := ed25519.GenPrivKey().PubKey()
return sdk.AccAddress(pubkey.Address()).String(), s.CreateSequencer(ctx, rollappId, pubkey)
}

func (s *KeeperTestHelper) CreateSequencer(ctx sdk.Context, rollappId string, pubKey types.PubKey) error {
addr := sdk.AccAddress(pubKey.Address())
// fund account
err = bankutil.FundAccount(s.App.BankKeeper, ctx, addr1, sdk.NewCoins(bond))
err := bankutil.FundAccount(s.App.BankKeeper, ctx, addr, sdk.NewCoins(bond))
s.Require().Nil(err)

pkAny, err := codectypes.NewAnyWithValue(pubKey)
s.Require().Nil(err)

sequencerMsg1 := sequencertypes.MsgCreateSequencer{
Creator: addr1.String(),
DymintPubKey: pkAny1,
Creator: addr.String(),
DymintPubKey: pkAny,
Bond: bond,
RollappId: rollappId,
Description: sequencertypes.Description{},
Metadata: sequencertypes.SequencerMetadata{},
}

msgServer := sequencerkeeper.NewMsgServerImpl(s.App.SequencerKeeper)
_, err = msgServer.CreateSequencer(ctx, &sequencerMsg1)
s.Require().Nil(err)
return addr1.String()
return err
}

func (s *KeeperTestHelper) PostStateUpdate(ctx sdk.Context, rollappId, seqAddr string, startHeight, numOfBlocks uint64) (lastHeight uint64, err error) {
Expand Down Expand Up @@ -114,15 +122,15 @@ func (s *KeeperTestHelper) FundAcc(acc sdk.AccAddress, amounts sdk.Coins) {
}

// FundModuleAcc funds target modules with specified amount.
func (suite *KeeperTestHelper) FundModuleAcc(moduleName string, amounts sdk.Coins) {
err := bankutil.FundModuleAccount(suite.App.BankKeeper, suite.Ctx, moduleName, amounts)
suite.Require().NoError(err)
func (s *KeeperTestHelper) FundModuleAcc(moduleName string, amounts sdk.Coins) {
err := bankutil.FundModuleAccount(s.App.BankKeeper, s.Ctx, moduleName, amounts)
s.Require().NoError(err)
}

// StateNotAltered validates that app state is not altered. Fails if it is.
func (suite *KeeperTestHelper) StateNotAltered() {
oldState := suite.App.ExportState(suite.Ctx)
suite.App.Commit()
newState := suite.App.ExportState(suite.Ctx)
suite.Require().Equal(oldState, newState)
func (s *KeeperTestHelper) StateNotAltered() {
oldState := s.App.ExportState(s.Ctx)
s.App.Commit()
newState := s.App.ExportState(s.Ctx)
s.Require().Equal(oldState, newState)
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions app/upgrades/v4/types/operating_status.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/upgrades/v4/types/params.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions app/upgrades/v4/types/rollapp.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading