Skip to content

Refactor: replace sidecar/rpc local types with upstream sei-tendermint coretypes #171

@bdchatham

Description

@bdchatham

Problem

sidecar/rpc/types.go defines local Go structs (StatusResult, NodeInfo, SyncInfo, BlockResult, BlockID, Block, BlockHeader, BlockResultsResult, TxResult) that duplicate canonical upstream types already available in our dependency tree:

  • github.com/sei-protocol/sei-chain/sei-tendermint/rpc/coretypes.ResultStatus
  • github.com/sei-protocol/sei-chain/sei-tendermint/rpc/coretypes.ResultBlock
  • github.com/sei-protocol/sei-chain/sei-tendermint/rpc/coretypes.ResultBlockResults
  • github.com/sei-protocol/sei-chain/sei-tendermint/types.NodeInfo

The duplication is pre-existing (not introduced by #163 / #170) — we already depend on sei-tendermint for the SDK RPC client wiring in sidecar/tasks/transactions.go.

Scope

Consumers that would need updating:

  • `sidecar/tasks/sign_and_broadcast.go:324` — `rpc.StatusResult` (chain-confusion guard)
  • `sidecar/tasks/peers.go:324` — `rpc.StatusResult`
  • `sidecar/tasks/statesync.go:206,225` — `rpc.StatusResult`, `rpc.BlockResult`
  • `sidecar/shadow/layer0.go:55,61` — `rpc.BlockResult`
  • `sidecar/shadow/layer1.go:72,108,114` — `rpc.TxResult`, `rpc.BlockResultsResult`
  • `sidecar/shadow/comparator_test.go` — `rpc.TxResult` (test fixtures)

The local `rpc.Client.Get` helper unwraps the JSON-RPC envelope into the inner `result`; upstream types are designed to be decoded the same way, so the helper itself likely stays.

Tradeoffs

  • Pro: removes duplicate schema definitions; canonical field naming (e.g. CometBFT calls it `network`, upstream agrees); future protocol changes track upstream automatically.
  • Con: upstream types carry more fields than we use (wider surface area in tests/snapshots); cross-cuts shadow + peers + statesync packages, so the refactor isn't isolated to one task.
  • Risk: none structural — same JSON shape, just different Go bindings.

Out of scope

  • Replacing the local `rpc.Client` HTTP helper (the JSON-RPC envelope unwrap is fine as-is).
  • Switching to the upstream RPC client (separate decision — has implications for connection pooling and Tendermint version coupling).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions