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 : Add support for avail DA #17

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
62 changes: 62 additions & 0 deletions Avail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## Instructions to Run Avail as a Data Availability (DA) Layer

To register Rollapp using Rollapp-EVM with Avail as the DA layer, follow the instructions provided in the [vitwit/rollapp-evm](https://github.com/vitwit/rollapp-evm/tree/fix_daconfig) repository.


#### Steps to Run the Roller:

Clone the roller repository, switch to the branch with Avail support, and build the project:
```bash
git clone https://github.com/vitwit/roller.git
git fetch && git checkout add_avail_support1
make build && make install
```

Follow the steps in the (official doc)https://github.com/vitwit/roller/tree/add_avail_support1, with the additional adjustments specified below.

init the rollapp

```bash
./build/roller rollapp init
```
After executing this command modify the `avail.toml` file with appropriate values. This file is located at `$HOME/.roller/da-light-node/avail.toml`. Use the following configuration as an example:
```bash
AccAddress = ""
AppID = 1n
Mnemonic = "bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice"
Root = ""
RpcEndpoint = "ws://127.0.0.1:9944"
```

setup the rollapp

```bash
./build/roller rollapp setup
```
After executing the above command verify and replace the fields in the `dymint.toml` file, which is located at `$HOME/.roller/rollapp/config/dymint.toml`. The configuration should look like the example below:
```bash
da_config = "{\"seed\": \"bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice\", \"api_url\": \"ws://127.0.0.1:9944\", \"app_id\": 1, \"tip\":0}"
max_proof_time = "1s"
max_idle_time = "2s"
batch_submit_time = "30s"
batch_acceptance_attempts = "5"
batch_acceptance_timeout = "2m0s"
batch_submit_bytes = 500000
batch_submit_max_time = "1h0m0s"
da_layer = "avail"
```

After making the above changes, you can run the following commands to register and start the services, including the DA light client:
```bash
./build/roller rollapp services load

./build/roller rollapp services start
```

Once all previous steps are complete, start the roller with:

```bash
./build/roller rollapp start
```

These are the required changes to verify before starting the Rollapp. Please follow the instructions above carefully before starting roller.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ To run Roller, use:
./build/roller
```

NOTE : If you are working with avail as a DA, please follow [these steps](./Avail.md) to ensure proper DA configuration

## Testing

To run all the tests, run from the root directory:
Expand Down
1 change: 1 addition & 0 deletions cmd/config/init/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func GetInitConfig(
cfg.HubData = hub

// cfg.RollerVersion = version.TrimVersionStr(version.BuildVersion)
// cfg.RollappID = "rollappevm_1234-1"
// cfg.RollappID = raID
// cfg.Denom = raBaseDenom

Expand Down
6 changes: 3 additions & 3 deletions cmd/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

const (
binsDir = "/usr/local/bin"
binsDir = "/usr/local/bin" // TODO : change me if binaries path was different
DefaultTokenSupply = "1000000000000000000000000000"
DefaultFee = 2000000000000000000 // 2
DefaultTxFee = 10000000000000000 // 0.01
Expand All @@ -31,7 +31,7 @@ var Executables = struct {
CelestiaApp string
}{
Roller: fmt.Sprintf("%s/roller", binsDir),
RollappEVM: fmt.Sprintf("%s/rollappd", binsDir),
RollappEVM: fmt.Sprintf("%s/rollapp-evm", binsDir), // changed rollappd to rollapp-evm binary
Dymension: fmt.Sprintf("%s/dymd", binsDir),
Celestia: fmt.Sprintf("%s/celestia", InternalBinsDir),
CelKey: fmt.Sprintf("%s/cel-key", InternalBinsDir),
Expand Down Expand Up @@ -60,7 +60,7 @@ var KeysIds = struct {
RollappSequencerPrivValidator: "rollapp_sequencer_priv_validator",
RollappRelayer: "relayer-rollapp-key",
HubRelayer: "relayer-hub-key",
Celestia: "my_celes_key",
Celestia: "", // my_celes_key
Eibc: "whale",
Da: "da_key",
}
Expand Down
22 changes: 22 additions & 0 deletions cmd/consts/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const (
MockDA DaNetwork = "mock"
CelestiaTestnet DaNetwork = "mocha-4"
CelestiaMainnet DaNetwork = "celestia"
AvailTestnet DaNetwork = "avail"
AvailMainnet DaNetwork = "avail-1" // change this with correct mainnet id
)

var DaNetworks = map[string]DaData{
Expand Down Expand Up @@ -72,4 +74,24 @@ var DaNetworks = map[string]DaData{
},
GasPrice: "0.002",
},
string(AvailTestnet): {
Backend: Avail,
ApiUrl: "http://localhost:8000",
ID: AvailTestnet,
RpcUrl: "ws://127.0.0.1:9944",
CurrentStateNode: "",
StateNodes: []string{
// "http://localhost:8000",
},
GasPrice: "",
},
string(AvailMainnet): {
Backend: Avail,
ApiUrl: "http://localhost:8000",
ID: AvailMainnet,
RpcUrl: "ws://127.0.0.1:9944",
CurrentStateNode: "",
StateNodes: []string{},
GasPrice: "",
},
}
21 changes: 13 additions & 8 deletions cmd/consts/dymension.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ var MainnetHubData = HubData{
RpcUrl: "https://dymension-mainnet-tendermint.public.blastapi.io",
ArchiveRpcUrl: "https://dymension-mainnet-tendermint.public.blastapi.io",
GasPrice: "20000000000",
DaNetwork: CelestiaMainnet,
// DaNetwork: string(CelestiaMainnet),
DaNetwork: AvailMainnet,
}

var TestnetHubData = HubData{
Expand All @@ -19,7 +20,8 @@ var TestnetHubData = HubData{
RpcUrl: "https://rpc-blumbus.mzonder.com",
ArchiveRpcUrl: "https://rpc-blumbus-archive.mzonder.com",
GasPrice: "20000000000",
DaNetwork: CelestiaTestnet,
DaNetwork: AvailTestnet,
// DaNetwork: string(CelestiaTestnet),
}

var LocalHubData = HubData{
Expand All @@ -43,13 +45,16 @@ var MockHubData = HubData{
}

var PlaygroundHubData = HubData{
Environment: "playground",
ApiUrl: "https://api-dymension-playground-2.mzonder.com:443",
ID: PlaygroundHubID,
RpcUrl: "https://rpc-dymension-playground-2.mzonder.com:443",
ArchiveRpcUrl: "https://rpc-dymension-playground-2.mzonder.com:443",
Environment: "playground",
// ApiUrl: "https://api-dymension-playground-2.mzonder.com:443",
ApiUrl: "http://localhost:1318",
ID: PlaygroundHubID,
// RpcUrl: "https://rpc-dymension-playground-2.mzonder.com:443",
// ArchiveRpcUrl: "https://rpc-dymension-playground-2.mzonder.com:443",
RpcUrl: "http://localhost:36657",
ArchiveRpcUrl: "http://localhost:36657",
GasPrice: "2000000000",
DaNetwork: CelestiaTestnet,
DaNetwork: AvailTestnet,
}

// TODO(#112): The available hub networks should be read from YAML file
Expand Down
3 changes: 3 additions & 0 deletions cmd/da-light-client/da_light_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/spf13/cobra"

da_start "github.com/dymensionxyz/roller/cmd/da-light-client/start"
"github.com/dymensionxyz/roller/cmd/da-light-client/update"
)

func DALightClientCmd() *cobra.Command {
Expand All @@ -12,5 +13,7 @@ func DALightClientCmd() *cobra.Command {
Short: "Commands for running and managing the data availability light client.",
}
cmd.AddCommand(da_start.Cmd())
cmd.AddCommand(update.Cmd())

return cmd
}
2 changes: 1 addition & 1 deletion cmd/da-light-client/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func Cmd() *cobra.Command {

func addFlags(cmd *cobra.Command) {
cmd.Flags().
StringP(rpcEndpointFlag, "", "mocha-4-consensus.mesa.newmetric.xyz", "The DA rpc endpoint to connect to.")
StringP(rpcEndpointFlag, "", "http://localhost:8000", "The DA rpc endpoint to connect to.") // TODO : change the DA rpc if required
cmd.Flags().
StringP(metricsEndpointFlag, "", "", "The OTEL collector metrics endpoint to connect to.")
}
55 changes: 55 additions & 0 deletions cmd/da-light-client/update/update.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package update

import (
"github.com/pterm/pterm"
"github.com/spf13/cobra"

"github.com/dymensionxyz/roller/utils/dependencies"
servicemanager "github.com/dymensionxyz/roller/utils/service_manager"
)

const (
rpcEndpointFlag = "rpc-endpoint"
metricsEndpointFlag = "metrics-endpoint"
)

func Cmd() *cobra.Command {
runCmd := &cobra.Command{
Use: "update",
Short: "Runs the DA light client.",
Run: func(cmd *cobra.Command, args []string) {
pterm.Info.Println("stopping existing system services, if any...")
err := servicemanager.StopSystemServices([]string{"da-light-client"})
if err != nil {
pterm.Error.Println("failed to stop system services: ", err)
return
}

dep := dependencies.DefaultCelestiaNodeDependency()
err = dependencies.InstallBinaryFromRepo(
dep, dep.DependencyName,
)
if err != nil {
pterm.Error.Println("failed to install binary: ", err)
return
}

pterm.Info.Println("stopping existing system services, if any...")
err = servicemanager.Start([]string{"da-light-client"})
if err != nil {
pterm.Error.Println("failed to stop system services: ", err)
return
}
},
}

addFlags(runCmd)
return runCmd
}

func addFlags(cmd *cobra.Command) {
cmd.Flags().
StringP(rpcEndpointFlag, "", "mocha-4-consensus.mesa.newmetric.xyz", "The DA rpc endpoint to connect to.")
cmd.Flags().
StringP(metricsEndpointFlag, "", "", "The OTEL collector metrics endpoint to connect to.")
}
3 changes: 0 additions & 3 deletions cmd/eibc/eibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/spf13/cobra"

"github.com/dymensionxyz/roller/cmd/eibc/fulfill"
"github.com/dymensionxyz/roller/cmd/eibc/funds"
eibcinit "github.com/dymensionxyz/roller/cmd/eibc/init"
"github.com/dymensionxyz/roller/cmd/eibc/scale"
"github.com/dymensionxyz/roller/cmd/eibc/start"
Expand All @@ -24,7 +23,6 @@ func Cmd() *cobra.Command {
cmd.AddCommand(eibcinit.Cmd())
cmd.AddCommand(start.Cmd())
cmd.AddCommand(scale.Cmd())
cmd.AddCommand(funds.Cmd())
cmd.AddCommand(fulfill.Cmd())

sl := []string{"eibc"}
Expand All @@ -34,7 +32,6 @@ func Cmd() *cobra.Command {
startservices.EibcCmd(),
restartservices.Cmd(sl),
stopservices.Cmd(sl),
// logservices.EibcCmd(),
),
)

Expand Down
23 changes: 0 additions & 23 deletions cmd/eibc/fulfill/denoms/denoms.go

This file was deleted.

62 changes: 0 additions & 62 deletions cmd/eibc/fulfill/denoms/list/list.go

This file was deleted.

Loading