From 26f2c7e93a5ec6ad36d367b0d077cc7dfa92979a Mon Sep 17 00:00:00 2001
From: Tyler <48813565+technicallyty@users.noreply.github.com>
Date: Mon, 26 Aug 2024 13:25:19 -0700
Subject: [PATCH] docs: clarify running connect <> chain locally (#706)
---
.gitignore | 1 +
docs/developers/integration.mdx | 94 +++++++++++++++++++++++++++++++--
docs/validators/faq.mdx | 4 ++
3 files changed, 94 insertions(+), 5 deletions(-)
diff --git a/.gitignore b/.gitignore
index 664e6fa9d..8fe2f3de2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ go.work*
# Testing script folders
/tests/.slinkyd
+/tests/.connectd
# build dir
/build/
diff --git a/docs/developers/integration.mdx b/docs/developers/integration.mdx
index 9e984d731..c587a0f89 100644
--- a/docs/developers/integration.mdx
+++ b/docs/developers/integration.mdx
@@ -369,22 +369,21 @@ Finally, call these methods back in `app.go`, directly after setting the `x/mark
app.initializeABCIExtensions(client, metrics)
```
-## Starting the Application
+## Initializing Modules
In order for the application to use Connect properly, the following is required:
- Set the consensus parameters to enable vote extensions
- Initialize `x/marketmap` with initial markets
-The following code can be executed within an upgrade handler for chains that are already live or in `InitChainer` for new chains:
-```go
+```go oracle.go
package app
import (
"slices"
- tmtypes "github.com/cometbft/cometbft/proto/tendermint/types"
+ tmtypes "github.com/cometbft/cometbft/proto/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/skip-mev/connect/v2/cmd/constants/marketmaps"
@@ -439,7 +438,92 @@ func (app *App) setupMarkets(ctx sdk.Context) error {
}
```
-With the Connect sidecar running, the application can now be started and will begin receiving price data at the configured `VoteExtensionsEnableHeight`.
+For new chains, or to test the integration, the method above can be called in `InitChainer`. Connect will begin posting prices to the chain once the `VoteExtensionsEnabledHeight` is reached.
+
+```go app.go
+package app
+
+func NewApp(
+ logger log.Logger,
+ db dbm.DB,
+ traceStore io.Writer,
+ loadLatest bool,
+ appOpts servertypes.AppOptions,
+ baseAppOptions ...func(*baseapp.BaseApp),
+) *App {
+ // ...
+
+ // initialize the chain with markets in state.
+ app.SetInitChainer(func(ctx sdk.Context, req *types.RequestInitChain) (*types.ResponseInitChain, error) {
+ err := app.setupMarkets(ctx)
+ if err != nil {
+ return nil, err
+ }
+ })
+
+ // ...
+}
+```
+
+For live running chains, use an upgrade handler. Note: Connect will not post prices to the chain until the upgrade is executed.
+
+```go app.go
+package app
+
+func NewApp(
+ logger log.Logger,
+ db dbm.DB,
+ traceStore io.Writer,
+ loadLatest bool,
+ appOpts servertypes.AppOptions,
+ baseAppOptions ...func(*baseapp.BaseApp),
+) *App {
+ // ...
+
+ connectUpgradeName := "connect-upgrade" // placeholder value, use a real upgrade name.
+
+ app.UpgradeKeeper.SetUpgradeHandler(connectUpgradeName, func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
+ migrations, err := app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
+ if err != nil {
+ return nil, err
+ }
+
+ // add the markets to the chain state.
+ err := app.setupMarkets(ctx)
+ if err != nil {
+ return migrations, err
+ }
+
+ return migrations, nil
+ })
+
+ upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
+ if err != nil {
+ panic(fmt.Errorf("failed to read upgrade info from disk: %w", err))
+ }
+
+
+ // add the x/marketmap and x/oracle stores.
+ if upgradeInfo.Name == connectUpgradeName {
+ app.SetStoreLoader(
+ upgradetypes.UpgradeStoreLoader(
+ upgradeInfo.Height,
+ &storetypes.StoreUpgrades{
+ Added: []string{marketmaptypes.ModuleName, oracletypes.ModuleName},
+ Renamed: nil,
+ Deleted: nil,
+ },
+ ),
+ )
+ }
+
+ // ...
+}
+```
+
+## Running the Node
+
+Once the chain is properly configured, head over to the [Quickstart](../validators/quickstart) guide to learn how to start the node with a Connect sidecar.
## Need Help?
diff --git a/docs/validators/faq.mdx b/docs/validators/faq.mdx
index c93581dd0..e8a4e8133 100644
--- a/docs/validators/faq.mdx
+++ b/docs/validators/faq.mdx
@@ -9,6 +9,10 @@ icon: circle-question
Yes, you can run it anywhere - but please defer to any chain-specific recommendations if there are any!
+
+ No, IPv6 is currently not supported for sidecar-node communication.
+
+
We are currently working on supporting this feature. It will be available in a future release.