mukan-ibc/docs/versioned_docs/version-v8.5.x/03-light-clients/02-localhost/03-client-state.md
Mukan Erkin Törük 6852832fe8
Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
Buf-Push / push (push) Has been cancelled
initial: sovereign Mukan Network fork
2026-05-11 03:18:28 +03:00

2.3 KiB

title sidebar_label sidebar_position slug
ClientState ClientState 3 /ibc/light-clients/localhost/client-state

ClientState

The 09-localhost ClientState maintains a single field used to track the latest sequence of the state machine i.e. the height of the blockchain.

type ClientState struct {
  // the latest height of the blockchain
  LatestHeight clienttypes.Height
}

The 09-localhost ClientState is instantiated in the InitGenesis handler of the 02-client submodule in core IBC. It calls CreateLocalhostClient, declaring a new ClientState and initializing it with its own client prefixed store.

func (k Keeper) CreateLocalhostClient(ctx sdk.Context) error {
  var clientState localhost.ClientState
  return clientState.Initialize(ctx, k.cdc, k.ClientStore(ctx, exported.LocalhostClientID), nil)
}

It is possible to disable the localhost client by removing the 09-localhost entry from the allowed_clients list through governance.

Client updates

The latest height is updated periodically through the ABCI BeginBlock interface of the 02-client submodule in core IBC.

See BeginBlocker in abci.go.

func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
  // ...

  if clientState, found := k.GetClientState(ctx, exported.Localhost); found {
    if k.GetClientStatus(ctx, clientState, exported.Localhost) == exported.Active {
      k.UpdateLocalhostClient(ctx, clientState)
    }
  }
}

The above calls into the 09-localhost UpdateState method of the ClientState . It retrieves the current block height from the application context and sets the LatestHeight of the 09-localhost client.

func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) []exported.Height {
  height := clienttypes.GetSelfHeight(ctx)
  cs.LatestHeight = height

  clientStore.Set(host.ClientStateKey(), clienttypes.MustMarshalClientState(cdc, &cs))

  return []exported.Height{height}
}

Note that the 09-localhost ClientState is not updated through the 02-client interface leveraged by conventional IBC light clients.