Repository: celestiaorg/celestia-app

Issue:
Binary does not use address in config.toml
## Context

https://github.com/celestiaorg/celestia-app/pull/4934#issuecomment-2945997082

## Problem

> resolved by adding --address "tcp://0.0.0.0:50058" (50058 is my set port) to the service, what means binary doesnt read this from config.toml



Discussion:
@maxzonder: 1. v3.10.1-mocha build with pebble
```
cd $HOME/celestia-app
git reset --hard
git checkout v3.10.1-mocha

# build v3
go mod edit -replace github.com/tendermint/tm-db=github.com/notional-labs/tm-db@v0.11.0
go mod tidy

mkdir -p build
go build -o ./build -ldflags "-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb \
 -X github.com/cosmos/cosmos-sdk/version.Name=celestia-app \
 -X github.com/cosmos/cosmos-sdk/version.AppName=celestia-appd \
 -X github.com/cosmos/cosmos-sdk/version.Version=$(git tag --points-at HEAD --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-mocha$$') \
 -X github.com/cosmos/cosmos-sdk/version.Commit=$(git log -1 --format='%H')" -tags pebbledb ./...
```

2. prepare binary from above for embedding to avoid downloading prebuilt v3 binary

```
cd build
tar czvf $HOME/celestia-app_linux_v3_amd64.tar.gz celestia-appd

# build v4
cd $HOME/celestia-app
git reset --hard
git checkout v4.0.2-mocha

# prepare for embedding
cp $HOME/celestia-app_linux_v3_amd64.tar.gz internal/embedding/celestia-app_linux_v3_amd64.tar.gz
echo "v3.10.1-mocha" > internal/embedding/.embed_version_celestia-app_linux_v3_amd64.tar.gz
```

3. patched makefile to build v4 pebble

```
# patch makefile

# line 23	- add pebbledb to tags 
# 23 BUILD_FLAGS_MULTIPLEXER := -tags "ledger multiplexer **pebbledb**" -ldflags '$(ldflags)'

# add types.DBBackend=pebbledb to ldflags 
# line 16   ldflags = -w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb \
```

4. started the node and got `listen tcp 0.0.0.0:36658: bind: address already in use`@maxzonder: also if i start this `v3.10.1-mocha` separately it works without `36658` issue, but when i start self-made v4 with self-made `v3.10.1-mocha`, i get '336658: bind: address already in use`@rootulp: I have a strong suspicion this is another multiplexer bug. https://github.com/celestiaorg/celestia-app/blob/984786703466aca8d6004ac8f871b1ad18791888/multiplexer/abci/multiplexer.go#L254-L258

In order of precedence I think this code should:
1. Use `--address` flag if provided by CLI
2. Use `proxy_app` field from config/config.toml
3. Use `127.0.0.1:36658` if neither of the above are provided

cc: @julienrbrt @rootulp: I'm not providing an `--address` flag but the multiplexer uses the default value for the `address` flag which is `36658`.

```
$ celestia-appd start --force-no-bbr
5:54PM INF initializing multiplexer app_version=1 chain_id=mocha-4 module=server
proxyApp: tcp://127.0.0.1:26658
tmAddress: tcp://127.0.0.1:36658
```@rootulp: > resolved by adding --address "tcp://0.0.0.0:50058" (50058 is my set port) to the service, what means binary doesnt read this from config.toml

Just to double check, @maxzonder you expected to _not_ need to provide the `--address` flag because you already set a custom port in the `config/config.toml` for `proxy_app`? Can you please include that section of your `config.toml` here?@maxzonder: correct

```
#######################################################################
###                   Main Base Config Options                      ###
#######################################################################

# TCP or UNIX socket address of the ABCI application,
# or the name of an ABCI application compiled in with the CometBFT binary
proxy_app = "tcp://127.0.0.1:50058"
```@damiannolan: So the multiplexer code is using the flag from the cosmos sdk server context and not respecting the cometbft/core config for `proxy_app` - which is technically the grpc client address to use for the grpc abci server. @damiannolan: Based on this https://github.com/celestiaorg/cosmos-sdk/blob/ce0956d3f49ea639bbd2be10af96e8e01739ad89/server/start.go#L993 (setting a default), my feeling is that here, `tmAddress` will never be empty string.

```go
tmAddress := m.svrCtx.Viper.GetString(flagTMAddress) 
```

I'm not sure if we can safely just assume a default fallback because, the abci server in the sdk must start the server on the fallback and then the client must also use the fallback. 
Assuming that viper flags populated the default in the server (sdk side) then we can make sure that the client (cometbft side) also uses the same default (https://github.com/celestiaorg/celestia-core/pull/1915).

There's certainly some confusion imposed for node operators as they must understand what it means to run the app in standalone mode, with cometbft connecting to the app state machine ABCI via grpc. 

I checked and it seems that the cometbft config, is merged into the viper instance, so IMO maybe we should do the following:
```go
abciServerAddr := m.svrCtx.Viper.GetString(flagTMAddress)   // TODO: Use exact flag var from sdk
proxyAppClientAddr := m.svrCtx.Viper.GetString("proxy_app") // TODO: Use exact flag var from comet
if abciServerAddr != proxyAppClientAddr {
	return fmt.Errorf("abci client and server addresses must match: client address %s is not equal to server address %s", proxyAppClientAddr, abciServerAddr)
}
```@rootulp: I was thinking the exact same thing last night, log a warning and error if the `address` does not match the `proxy_app` field.

Solution patch:
diff --git a/docs/release-notes/release-notes.md b/docs/release-notes/release-notes.md
index 08cf642d..b3144298 100644
--- a/docs/release-notes/release-notes.md
+++ b/docs/release-notes/release-notes.md
@@ -10,6 +10,8 @@ This guide provides notes for major version releases. These notes may be helpful
 
 Celestia-app v4.0.0 introduces support for a [multiplexer](https://github.com/celestiaorg/celestia-app/tree/e5d5ac6732c55150ea3573e17bec162fe836e0c6/multiplexer) that makes it easier for node operators to run a consensus node that can sync from genesis. The multiplexer contains an embedded celestia-app v3.x.x binary that will be used to sync the node from genesis. After the chain advances to app version v4, the multiplexer will stop routing requests to the embedded celestia-app v3.x.x binary and will instead route requests to the the v4.x.x state machine. Binaries that are installed from source (via `make install`) will include support for the multiplexer. To install Celestia without the multiplexer, you can use the `make install-standalone` target. Note that the standalone binary will only be able to run on networks that have already upgraded to app version v4.
 
+`make install` currently downloads a v3.x binary with goleveldb support. If you use pebbledb, you will need to build the v3.x binary from source (with the `pebbledb` build tag) and include it in the app's embedded binary directory (by default: `~/.celestia-app/bin/`).
+
 #### `rpc.grpc_laddr`
 
 The `rpc.grpc_laddr` config option is now required when running the celestia-app binary with the multiplexer. This option can be set via CLI flag `--rpc.grpc_laddr tcp://127.0.0.1:9098` or in the `config.toml`:
@@ -29,14 +31,17 @@ Celestia-app v4.0.0 includes significant state machine changes due to major depe
 #### New Messages (Added Modules)
 
 **`x/circuit` Circuit Breaker Module** ([cosmos-sdk docs](https://docs.cosmos.network/v0.50/build/modules/circuit)):
+
 - `MsgAuthorizeCircuitBreaker` - Grant circuit breaker permissions
 - `MsgTripCircuitBreaker` - Disable message execution
 - `MsgResetCircuitBreaker` - Re-enable message execution
 
 **`x/consensus` Consensus Parameters Module** ([cosmos-sdk docs](https://docs.cosmos.network/v0.50/build/modules/consensus)):
+
 - `MsgUpdateParams` - Update consensus parameters via governance (replaces CometBFT consensus param updates)
 
 **Hyperlane**:
+
 - `hyperlane/core` - Cross-chain messaging infrastructure
 - `hyperlane/warp` - Token bridging and routing
 
@@ -45,14 +50,17 @@ Celestia-app v4.0.0 includes significant state machine changes due to major depe
 **`x/crisis` Module** - Removed in Cosmos SDK v0.50.x
 
 **`x/capability` Module** - Removed in Cosmos SDK v0.50.x:
+
 - IBC capability management integrated directly into IBC v8 modules
 
 **`x/paramfilter` Module** - Celestia-specific module removed:
+
 - Parameter filtering functionality replaced by circuit breaker
 
 #### Changed Messages and Logic
 
 **Parameter Management Migration**:
+
 - **Generic parameter proposals** deprecated in favor of module-specific `MsgUpdateParams` messages
 - **Consensus parameters** moved from CometBFT to dedicated `x/consensus` module
 - **All modules** now use module-specific parameter update messages instead of legacy `x/params` proposals
@@ -62,11 +70,13 @@ Celestia-app v4.0.0 includes significant state machine changes due to major depe
 ### Library Consumers (v4.0.0)
 
 **Import Changes**:
+
 - Add: `cosmossdk.io/x/circuit`, `cosmossdk.io/x/consensus`
 - Remove: `x/capability`, `x/crisis`, `x/paramfilter`
 - Update: `github.com/cosmos/ibc-go/v8` (from v6)
 
 **API Breaking Changes** ([cosmos-sdk migration guide](https://docs.cosmos.network/v0.50/build/migrations/upgrading)):
+
 - Module keepers now accept `context.Context` instead of `sdk.Context`
 - `BeginBlock`/`EndBlock` signatures changed
 - Parameter updates require module-specific `MsgUpdateParams` messages
diff --git a/go.mod b/go.mod
index f12994b3..46aae179 100644
--- a/go.mod
+++ b/go.mod
@@ -16,7 +16,7 @@ require (
 	cosmossdk.io/x/feegrant v0.1.1
 	cosmossdk.io/x/tx v0.13.8
 	cosmossdk.io/x/upgrade v0.1.4
-	github.com/bcp-innovations/hyperlane-cosmos v1.0.0
+	github.com/bcp-innovations/hyperlane-cosmos v1.0.1
 	github.com/celestiaorg/go-square/v2 v2.2.0
 	github.com/celestiaorg/knuu v0.16.3
 	github.com/celestiaorg/nmt v0.24.0
diff --git a/go.sum b/go.sum
index 2aac6d11..2d8f067b 100644
--- a/go.sum
+++ b/go.sum
@@ -322,8 +322,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.33.14 h1:TzeR06UCMUq+KA3bDkujxK1GVGy
 github.com/aws/aws-sdk-go-v2/service/sts v1.33.14/go.mod h1:dspXf/oYWGWo6DEvj98wpaTeqt5+DMidZD0A9BYTizc=
 github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ=
 github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
-github.com/bcp-innovations/hyperlane-cosmos v1.0.0 h1:h1AP5gTCCWABlIPxy5pXXuSvMmDgCie1U/iRxNa+TT0=
-github.com/bcp-innovations/hyperlane-cosmos v1.0.0/go.mod h1:3yfa0io5Ii6GmhHWsWl2LEAOEHsqWuMgw2R02+LPogw=
+github.com/bcp-innovations/hyperlane-cosmos v1.0.1 h1:gT8OqyJ866Q6AHOlIXKxSdLjd0p8crKG9XXERIWoh4c=
+github.com/bcp-innovations/hyperlane-cosmos v1.0.1/go.mod h1:3yfa0io5Ii6GmhHWsWl2LEAOEHsqWuMgw2R02+LPogw=
 github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=



Test patch:
diff --git a/test/docker-e2e/go.mod b/test/docker-e2e/go.mod
index ddeedac2..1f9db4d3 100644
--- a/test/docker-e2e/go.mod
+++ b/test/docker-e2e/go.mod
@@ -67,7 +67,7 @@ require (
 	github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.14 // indirect
 	github.com/aws/aws-sdk-go-v2/service/sts v1.33.14 // indirect
 	github.com/aws/smithy-go v1.22.2 // indirect
-	github.com/bcp-innovations/hyperlane-cosmos v1.0.0 // indirect
+	github.com/bcp-innovations/hyperlane-cosmos v1.0.1 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
 	github.com/bgentry/speakeasy v0.2.0 // indirect
diff --git a/test/docker-e2e/go.sum b/test/docker-e2e/go.sum
index 4e941c4f..3d2b2d69 100644
--- a/test/docker-e2e/go.sum
+++ b/test/docker-e2e/go.sum
@@ -318,8 +318,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.33.14 h1:TzeR06UCMUq+KA3bDkujxK1GVGy
 github.com/aws/aws-sdk-go-v2/service/sts v1.33.14/go.mod h1:dspXf/oYWGWo6DEvj98wpaTeqt5+DMidZD0A9BYTizc=
 github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ=
 github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
-github.com/bcp-innovations/hyperlane-cosmos v1.0.0 h1:h1AP5gTCCWABlIPxy5pXXuSvMmDgCie1U/iRxNa+TT0=
-github.com/bcp-innovations/hyperlane-cosmos v1.0.0/go.mod h1:3yfa0io5Ii6GmhHWsWl2LEAOEHsqWuMgw2R02+LPogw=
+github.com/bcp-innovations/hyperlane-cosmos v1.0.1 h1:gT8OqyJ866Q6AHOlIXKxSdLjd0p8crKG9XXERIWoh4c=
+github.com/bcp-innovations/hyperlane-cosmos v1.0.1/go.mod h1:3yfa0io5Ii6GmhHWsWl2LEAOEHsqWuMgw2R02+LPogw=
 github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=