Skip to content

Commit

Permalink
Merge branch 'main' into release/v0.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ItayLevyOfficial committed Sep 6, 2023
2 parents 3ccb7a0 + ecfe396 commit 5bd7de1
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 64 deletions.
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,9 @@ To run the all the tests, run from the root directory:
go test ./...
```

## Creating a New Release
## Installing a Pre Release

Roller features a convenient Continuous Deployment (CD) workflow that
automatically generates all required assets after a new release is
created. To use it, simply create a new release on GitHub, and the
process will build and upload the release assets for you.
(works also for pre-releases)
By default, when installing Roller with

```bash
curl -L https://dymensionxyz.github.io/roller/install.sh | bash
```

It will install the latest release.
To install a specific version, use:
To install a specific pre-release version, use:

```bash
export ROLLER_RELEASE_TAG="<RELEASE_TAG>"
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func Cmd() *cobra.Command {
},
Type: RollApp,
Description: nil,
Analytics: false,
Analytics: true,
}
if rlpCfg.VMType == config.EVM_ROLLAPP {
evmID := config.GetEthID(rlpCfg.RollappID)
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/init/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func addFlags(cmd *cobra.Command) error {

func GetInitConfig(initCmd *cobra.Command, args []string) (config.RollappConfig, error) {
cfg := config.RollappConfig{
RollerVersion: version.BuildVersion,
RollerVersion: version.TrimVersionStr(version.BuildVersion),
}
cfg.Home = initCmd.Flag(utils.FlagNames.Home).Value.String()
cfg.RollappBinary = initCmd.Flag(FlagNames.RollappBinary).Value.String()
Expand Down
10 changes: 6 additions & 4 deletions cmd/config/set/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/dymensionxyz/roller/cmd/utils"
"github.com/dymensionxyz/roller/config"
"github.com/spf13/cobra"
"strings"
)

var keyUpdateFuncs = map[string]func(cfg config.RollappConfig, value string) error{
Expand All @@ -19,9 +20,10 @@ var keyUpdateFuncs = map[string]func(cfg config.RollappConfig, value string) err

func Cmd() *cobra.Command {
cmd := &cobra.Command{
Use: "set <key> <value>",
Short: "Updates the specified key in all relevant places within the roller configuration files.",
Args: cobra.ExactArgs(2),
Use: "set <key> <value>",
Short: fmt.Sprintf("Updates the specified key in all relevant places within the roller configuration files. "+
"The Supported keys are %s", strings.Join(getSupportedKeys(), ", ")),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
home := cmd.Flag(utils.FlagNames.Home).Value.String()
rlpCfg, err := config.LoadConfigFromTOML(home)
Expand All @@ -33,7 +35,7 @@ func Cmd() *cobra.Command {
if updateFunc, exists := keyUpdateFuncs[key]; exists {
return updateFunc(rlpCfg, value)
}
return fmt.Errorf("invalid key. Supported keys are: %v", getSupportedKeys())
return fmt.Errorf("invalid key. Supported keys are: %v", strings.Join(getSupportedKeys(), ", "))
},
}
return cmd
Expand Down
1 change: 1 addition & 0 deletions cmd/da-light-client/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func Cmd() *cobra.Command {
home := cmd.Flag(utils.FlagNames.Home).Value.String()
rollappConfig, err := config.LoadConfigFromTOML(home)
utils.PrettifyErrorIfExists(err)
utils.RequireMigrateIfNeeded(rollappConfig)
metricsEndpoint := cmd.Flag(metricsEndpointFlag).Value.String()
if metricsEndpoint != "" && rollappConfig.DA != config.Celestia {
utils.PrettifyErrorIfExists(errors.New("metrics endpoint can only be set for celestia"))
Expand Down
10 changes: 2 additions & 8 deletions cmd/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package migrate

import (
"fmt"
"strings"

"github.com/dymensionxyz/roller/cmd/utils"
"github.com/dymensionxyz/roller/config"
"github.com/dymensionxyz/roller/version"
Expand Down Expand Up @@ -35,7 +33,7 @@ func Cmd() *cobra.Command {
utils.PrettifyErrorIfExists(migrator.PerformMigration(rlpCfg))
}
}
trimmedCurrentVersion := trimVersionStr(version.BuildVersion)
trimmedCurrentVersion := version.TrimVersionStr(version.BuildVersion)
rlpCfg.RollerVersion = trimmedCurrentVersion
err = config.WriteConfigToTOML(rlpCfg)
utils.PrettifyErrorIfExists(err)
Expand All @@ -45,10 +43,6 @@ func Cmd() *cobra.Command {
return cmd
}

func trimVersionStr(versionStr string) string {
return strings.Split(versionStr, "-")[0]
}

func GetPrevVersionData(rlpCfg config.RollappConfig) (*VersionData, error) {
rollerPrevVersion := rlpCfg.RollerVersion
var major, minor, patch int
Expand All @@ -60,7 +54,7 @@ func GetPrevVersionData(rlpCfg config.RollappConfig) (*VersionData, error) {
Patch: 3,
}, nil
}
trimmedVersionStr := trimVersionStr(rollerPrevVersion)
trimmedVersionStr := version.TrimVersionStr(rollerPrevVersion)
n, err := fmt.Sscanf(trimmedVersionStr, "v%d.%d.%d", &major, &minor, &patch)
if err != nil {
return nil, err
Expand Down
12 changes: 6 additions & 6 deletions cmd/migrate/v_0_1_12.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ func (v *VersionMigratorV0112) PerformMigration(rlpCfg config.RollappConfig) err
rlpCfg.DA = config.Local
return config.WriteConfigToTOML(rlpCfg)
}
if rlpCfg.DA == config.Avail {
availNewCfgPath := avail.GetCfgFilePath(rlpCfg.Home)
if err := utils.MoveFile(filepath.Join(rlpCfg.Home, avail.ConfigFileName), availNewCfgPath); err != nil {
return err
}
}
da := datalayer.NewDAManager(rlpCfg.DA, rlpCfg.Home)
sequencerDaConfig := da.GetSequencerDAConfig()
if sequencerDaConfig == "" {
Expand All @@ -29,11 +35,5 @@ func (v *VersionMigratorV0112) PerformMigration(rlpCfg config.RollappConfig) err
if err := utils.UpdateFieldInToml(dymintTomlPath, "da_config", sequencerDaConfig); err != nil {
return err
}
if rlpCfg.DA == config.Avail {
availNewCfgPath := avail.GetCfgFilePath(rlpCfg.Home)
if err := utils.MoveFile(filepath.Join(rlpCfg.Home, avail.ConfigFileName), availNewCfgPath); err != nil {
return err
}
}
return nil
}
1 change: 1 addition & 0 deletions cmd/relayer/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func Start() *cobra.Command {
home := cmd.Flag(utils.FlagNames.Home).Value.String()
rollappConfig, err := config.LoadConfigFromTOML(home)
utils.PrettifyErrorIfExists(err)
utils.RequireMigrateIfNeeded(rollappConfig)

VerifyRelayerBalances(rollappConfig)
relayerLogFilePath := utils.GetRelayerLogPath(rollappConfig)
Expand Down
1 change: 1 addition & 0 deletions cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func Cmd() *cobra.Command {
home := cmd.Flag(utils.FlagNames.Home).Value.String()
rollappConfig, err := config.LoadConfigFromTOML(home)
utils.PrettifyErrorIfExists(err)
utils.RequireMigrateIfNeeded(rollappConfig)
logger := utils.GetRollerLogger(rollappConfig.Home)

ctx, cancel := context.WithCancel(context.Background())
Expand Down
1 change: 1 addition & 0 deletions cmd/sequencer/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func StartCmd() *cobra.Command {
home := cmd.Flag(utils.FlagNames.Home).Value.String()
rollappConfig, err := config.LoadConfigFromTOML(home)
utils.PrettifyErrorIfExists(err)
utils.RequireMigrateIfNeeded(rollappConfig)
LogPath = filepath.Join(rollappConfig.Home, consts.ConfigDirName.Rollapp, "rollapp.log")
RollappDirPath = filepath.Join(rollappConfig.Home, consts.ConfigDirName.Rollapp)
sequencerInsufficientAddrs, err := utils.GetSequencerInsufficientAddrs(rollappConfig, OneDaySequencePrice)
Expand Down
13 changes: 13 additions & 0 deletions cmd/utils/error_handling.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package utils

import (
"github.com/dymensionxyz/roller/config"
"github.com/dymensionxyz/roller/version"
"github.com/fatih/color"
"os"
"os/signal"
Expand All @@ -23,6 +25,17 @@ func PrettifyErrorIfExists(err error, printAdditionalInfo ...func()) {
}
}

func RequireMigrateIfNeeded(rlpCfg config.RollappConfig) {
currentRollerVersion := version.TrimVersionStr(version.BuildVersion)
configRollerVersion := version.TrimVersionStr(rlpCfg.RollerVersion)
if configRollerVersion != currentRollerVersion {
color.New(color.FgRed, color.Bold).Printf("💈 Your rollapp config version ('%s') is older than your"+
" installed roller version ('%s'),"+
" please run 'roller migrate' to update your config.\n", configRollerVersion, currentRollerVersion)
os.Exit(1)
}
}

func RunOnInterrupt(funcToRun func()) {
go func() {
c := make(chan os.Signal, 1)
Expand Down
2 changes: 1 addition & 1 deletion data_layer/avail/avail.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (a *Avail) GetNetworkName() string {
}

func (a *Avail) GetStatus(c config.RollappConfig) string {
return "Running"
return "Active"
}

func (a *Avail) GetKeyName() string {
Expand Down
6 changes: 3 additions & 3 deletions relayer/create_ibc_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ func waitForValidRollappHeight(seq *sequencer.Sequencer) error {
continue
}
if hubHeight < 3 {
fmt.Printf("💈 Waiting for hub height to be greater than 2, current height: %d\n", hubHeight)
fmt.Printf("💈 Waiting for the rollapp height on the hub to be greater than 2, current height: %d\n", hubHeight)
continue
}
if hubHeight <= initialHubHeight {
fmt.Printf("💈 Waiting for hub height to be greater than initial height,"+
" initial height: %d,current height: %d\n", initialHubHeight, hubHeight)
fmt.Printf("💈 Waiting for the rollapp height on the hub to be greater than initial height,"+
" initial height: %d, current height: %d\n", initialHubHeight, hubHeight)
continue
}
rollappHeightStr, err := seq.GetRollappHeight()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ global:
memo: ""
light-cache-size: 20
chains:
devnet_304-1:
dymension_100-1:
type: cosmos
value:
key: relayer-hub-key
chain-id: devnet_304-1
rpc-addr: https://dymension-devnet.rpc.silknodes.io:443
chain-id: dymension_100-1
rpc-addr: http://localhost:36657
account-prefix: dym
keyring-backend: test
gas-adjustment: 1.2
gas-prices: 0.25udym
gas-prices: 0udym
debug: true
timeout: 10s
output-format: json
Expand All @@ -35,12 +35,12 @@ chains:
sign-mode: direct
client-type: 01-dymint
paths:
hub-rollapp:
rollapp-hub:
src:
chain-id: mars_1238-1
chain-id: dymension_100-1
dst:
chain-id: devnet_304-1
chain-id: mars_1238-1
src-channel-filter:
rule: ""
channel-list: []
settlement: devnet_304-1
settlement: dymension_100-1
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ block_time = "0.2s"
da_config = "PLACEHOLDER_DA_CONFIG"
da_layer = "celestia"
dym_account_name = "hub_sequencer"
empty_blocks_max_time = "60s"
empty_blocks_max_time = "3600s"
gas_fees = ""
gas_limit = 0
gas_prices = "0.25udym"
gas_prices = "0udym"
keyring_backend = "test"
keyring_home_dir = "PLACEHOLDER_KEYRING_HOME_DIR"
namespace_id = "PLACEHOLDER_NAMESPACE_ID"
node_address = "https://dymension-devnet.rpc.silknodes.io:443"
node_address = "http://localhost:36657"
rollapp_id = "mars_1238-1"
settlement_layer = "dymension"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"hub_sequencer","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"ethm1fhnj5f0ghtlju5cd8zrdrky7cn7rfjh4d4mwsw","validator_address":"ethmvaloper1fhnj5f0ghtlju5cd8zrdrky7cn7rfjh4z93zgn","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"0/ApLj1BjXdNQS2Uy3phsKs9U/N0+2CZDCDJhSwbJ6M="},"value":{"denom":"udym","amount":"500000000000000000000"}}],"memo":"[email protected]:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"Audm6qmAO/cyHKgKjvLWWe/rfVYICii/pVOePKSdcG3h"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":["PVm+sMhJWsYZ3aIjMbKkiehX15kmsUbMLM4vVN9MFsVNV3smgm4BH/jc+zpd+Fbc/zwPuR0Aw1m2/L9+pOjPqwA="]}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ global:
memo: ""
light-cache-size: 20
chains:
devnet_304-1:
dymension_100-1:
type: cosmos
value:
key: relayer-hub-key
chain-id: devnet_304-1
rpc-addr: https://dymension-devnet.rpc.silknodes.io:443
chain-id: dymension_100-1
rpc-addr: http://localhost:36657
account-prefix: dym
keyring-backend: test
gas-adjustment: 1.2
gas-prices: 0.25udym
gas-prices: 0udym
debug: true
timeout: 10s
output-format: json
Expand All @@ -35,12 +35,12 @@ chains:
sign-mode: direct
client-type: 01-dymint
paths:
hub-rollapp:
rollapp-hub:
src:
chain-id: mars_1238-1
chain-id: dymension_100-1
dst:
chain-id: devnet_304-1
chain-id: mars_1238-1
src-channel-filter:
rule: ""
channel-list: []
settlement: devnet_304-1
settlement: dymension_100-1
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ block_time = "0.2s"
da_config = "PLACEHOLDER_DA_CONFIG"
da_layer = "celestia"
dym_account_name = "hub_sequencer"
empty_blocks_max_time = "60s"
empty_blocks_max_time = "3600s"
gas_fees = ""
gas_limit = 0
gas_prices = "0.25udym"
gas_prices = "0udym"
keyring_backend = "test"
keyring_home_dir = "PLACEHOLDER_KEYRING_HOME_DIR"
namespace_id = "PLACEHOLDER_NAMESPACE_ID"
node_address = "https://dymension-devnet.rpc.silknodes.io:443"
node_address = "http://localhost:36657"
rollapp_id = "mars_1238-1"
settlement_layer = "dymension"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"hub_sequencer","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"ethm1lg494fsvlznfqnmjp3ux7h52rh59j3l7l7y3jg","validator_address":"ethmvaloper1lg494fsvlznfqnmjp3ux7h52rh59j3l7swwa24","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"aeGRXQyp2n14AGAMMRvfx5pSn433gzAYDP3fUhe7PVc="},"value":{"denom":"udym","amount":"500000000000000000000000000"}}],"memo":"[email protected]:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"AoyjSOcURvhaysJi7KEOswMtJrUUmEGFa9mNbeC2gwJd"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":["1Lk6euTnb/w1bTZ63NKWAhC61RCNCKA7k3BdFHs6d0pjcVcnfqQHqGA/7KKyxJHtdqQtqIoa4vBMjbbPQojX6wE="]}
6 changes: 4 additions & 2 deletions test/config/init/init_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package initconfig_test

import (
"fmt"
"github.com/dymensionxyz/roller/config"
"path/filepath"
"testing"
Expand All @@ -26,7 +27,7 @@ func TestInitCmd(t *testing.T) {
goldenDirPath: "./goldens/init_without_flags",
excludedDirs: []string{"gentx"},
optionalFlags: []string{
"--" + initconfig.FlagNames.HubID, "devnet",
"--" + initconfig.FlagNames.HubID, "local",
},
},
{
Expand All @@ -35,7 +36,7 @@ func TestInitCmd(t *testing.T) {
excludedDirs: []string{"gentx"},
optionalFlags: []string{
"--" + initconfig.FlagNames.TokenSupply, tokenSupply,
"--" + initconfig.FlagNames.HubID, "devnet",
"--" + initconfig.FlagNames.HubID, "local",
},
},
}
Expand All @@ -44,6 +45,7 @@ func TestInitCmd(t *testing.T) {
assert := assert.New(t)
tempDir, err := os.MkdirTemp(os.TempDir(), "test")
tempDir = filepath.Join(tempDir, ".roller")
fmt.Println(tempDir, tc.name)
assert.NoError(err)
defer func() {
err := os.RemoveAll(tempDir)
Expand Down
5 changes: 3 additions & 2 deletions test/config/init/testutils/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ const innerKeysDirName = "keyring-test"
const addressPattern = `.*\.address`

func SanitizeConfigDir(root string) error {
keyDirs := []string{getLightNodeKeysDir(root), getRelayerKeysDir(root), getRollappKeysDir(root), getHubKeysDir(root)}
for _, dir := range keyDirs {
dirsToClean := []string{getLightNodeKeysDir(root), getRelayerKeysDir(root), getRollappKeysDir(root),
getHubKeysDir(root), filepath.Join(root, consts.ConfigDirName.LocalHub)}
for _, dir := range dirsToClean {
if err := os.RemoveAll(dir); err != nil {
return err
}
Expand Down
6 changes: 6 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package version

import "strings"

var (
BuildVersion = "<version>"
BuildTime = "<build-time>"
BuildCommit = "<build-commit>"
)

func TrimVersionStr(versionStr string) string {
return strings.Split(versionStr, "-")[0]
}

0 comments on commit 5bd7de1

Please sign in to comment.