-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ability to run rollapps with the
roller run
command (#66)
- Loading branch information
1 parent
870b254
commit 9675558
Showing
12 changed files
with
175 additions
and
66 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package run | ||
|
||
import ( | ||
"fmt" | ||
"github.com/dymensionxyz/roller/cmd/consts" | ||
"os/exec" | ||
"path/filepath" | ||
|
||
initconfig "github.com/dymensionxyz/roller/cmd/config/init" | ||
"github.com/dymensionxyz/roller/cmd/utils" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
const daLightClientEndpointFlag = "da-light-client-endpoint" | ||
|
||
func RunCmd() *cobra.Command { | ||
runCmd := &cobra.Command{ | ||
Use: "run", | ||
Short: "Runs the rollapp sequencer.", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
home := cmd.Flag(utils.FlagNames.Home).Value.String() | ||
rollappConfig, err := initconfig.LoadConfigFromTOML(home) | ||
utils.PrettifyErrorIfExists(err) | ||
startRollappCmd := getStartRollapCmd(rollappConfig, cmd.Flag(daLightClientEndpointFlag).Value.String()) | ||
startRollappErr := startRollappCmd.Run() | ||
utils.PrettifyErrorIfExists(startRollappErr) | ||
}, | ||
} | ||
addFlags(runCmd) | ||
utils.AddGlobalFlags(runCmd) | ||
return runCmd | ||
} | ||
|
||
func addFlags(cmd *cobra.Command) { | ||
cmd.Flags().StringP(daLightClientEndpointFlag, "", "http://localhost:26659", "The DA light client endpoint.") | ||
} | ||
|
||
func getStartRollapCmd(rollappConfig initconfig.InitConfig, daLightClientEndpoint string) *exec.Cmd { | ||
daConfig := fmt.Sprintf(`{"base_url": "%s", "timeout": 60000000000, "fee":20000, "gas_limit": 20000000, "namespace_id":[0,0,0,0,0,0,255,255]}`, daLightClientEndpoint) | ||
rollappConfigDir := filepath.Join(rollappConfig.Home, consts.ConfigDirName.Rollapp) | ||
settlementConfig := fmt.Sprintf(`{"node_address": "%s", "rollapp_id": "%s", "dym_account_name": "%s", "keyring_home_dir": "%s", "keyring_backend":"test", "gas_fees": "2000000udym"}`, | ||
rollappConfig.HubData.RPC_URL, rollappConfig.RollappID, consts.KeyNames.HubSequencer, rollappConfigDir) | ||
|
||
return exec.Command( | ||
rollappConfig.RollappBinary, "start", | ||
"--dymint.aggregator", | ||
"--json-rpc.enable", | ||
"--json-rpc.api", "eth,txpool,personal,net,debug,web3,miner", | ||
"--dymint.da_layer", "celestia", | ||
"--dymint.da_config", daConfig, | ||
"--dymint.settlement_layer", "dymension", | ||
"--dymint.settlement_config", settlementConfig, | ||
"--dymint.block_batch_size", "1200", | ||
"--dymint.namespace_id", "000000000000ffff", | ||
"--dymint.block_time", "0.2s", | ||
"--home", rollappConfigDir, | ||
"--log_level", "debug", | ||
"--log-file", filepath.Join(rollappConfigDir, "rollapp.log"), | ||
"--max-log-size", "2000", | ||
"--module-log-level-override", "", | ||
) | ||
} |
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
File renamed without changes.
77 changes: 77 additions & 0 deletions
77
test/config/init/goldens/init_without_flags/da-light-node/config.toml
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,77 @@ | ||
[Core] | ||
IP = "0.0.0.0" | ||
RPCPort = "0" | ||
GRPCPort = "0" | ||
|
||
[State] | ||
KeyringAccName = "" | ||
KeyringBackend = "test" | ||
|
||
[P2P] | ||
ListenAddresses = ["/ip4/0.0.0.0/udp/2121/quic-v1", "/ip6/::/udp/2121/quic-v1", "/ip4/0.0.0.0/tcp/2121", "/ip6/::/tcp/2121"] | ||
AnnounceAddresses = [] | ||
NoAnnounceAddresses = ["/ip4/0.0.0.0/udp/2121/quic-v1", "/ip4/127.0.0.1/udp/2121/quic-v1", "/ip6/::/udp/2121/quic-v1", "/ip4/0.0.0.0/tcp/2121", "/ip4/127.0.0.1/tcp/2121", "/ip6/::/tcp/2121"] | ||
MutualPeers = [] | ||
PeerExchange = false | ||
RoutingTableRefreshPeriod = "1m0s" | ||
[P2P.ConnManager] | ||
Low = 50 | ||
High = 100 | ||
GracePeriod = "1m0s" | ||
|
||
[RPC] | ||
Address = "0.0.0.0" | ||
Port = "26658" | ||
|
||
[Gateway] | ||
Address = "0.0.0.0" | ||
Port = "26659" | ||
Enabled = false | ||
|
||
[Share] | ||
UseShareExchange = true | ||
[Share.ShrExEDSParams] | ||
ServerReadTimeout = "5s" | ||
ServerWriteTimeout = "1m0s" | ||
HandleRequestTimeout = "1m0s" | ||
ConcurrencyLimit = 10 | ||
BufferSize = 32768 | ||
[Share.ShrExNDParams] | ||
ServerReadTimeout = "5s" | ||
ServerWriteTimeout = "1m0s" | ||
HandleRequestTimeout = "1m0s" | ||
ConcurrencyLimit = 10 | ||
[Share.PeerManagerParams] | ||
PoolValidationTimeout = "2m0s" | ||
PeerCooldown = "3s" | ||
GcInterval = "30s" | ||
EnableBlackListing = false | ||
[Share.LightAvailability] | ||
SampleAmount = 16 | ||
[Share.Discovery] | ||
PeersLimit = 5 | ||
AdvertiseInterval = "22h0m0s" | ||
|
||
[Header] | ||
TrustedHash = "" | ||
TrustedPeers = [] | ||
[Header.Store] | ||
StoreCacheSize = 4096 | ||
IndexCacheSize = 16384 | ||
WriteBatchSize = 2048 | ||
[Header.Syncer] | ||
TrustingPeriod = "168h0m0s" | ||
[Header.Server] | ||
WriteDeadline = "8s" | ||
ReadDeadline = "1m0s" | ||
RangeRequestTimeout = "10s" | ||
[Header.Client] | ||
MaxHeadersPerRangeRequest = 64 | ||
RangeRequestTimeout = "8s" | ||
|
||
[DASer] | ||
SamplingRange = 100 | ||
ConcurrencyLimit = 16 | ||
BackgroundStoreInterval = "10m0s" | ||
SampleFrom = 1 | ||
SampleTimeout = "4m0s" |
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