Skip to content

Conversation

@fbac
Copy link
Collaborator

@fbac fbac commented Jun 9, 2025

xmtpd-cli is a CLI to manage the XMTP Network

Usage:
  xmtpd-cli [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  keys        Manage keys
  nodes       Manage Node Registry
  rates       Manage Rate Registry

Flags:
  -c, --config-file string    path to the config file (default "./dev/environments/anvil.json")
  -h, --help                  help for xmtpd-cli
  -e, --log-encoding string   set log encoding. Available encodings: console, json (default "console")
  -l, --log-level string      set logging level. Available levels: debug, info, warn, error, fatal, panic (default "info")
  -p, --private-key string    private key to use
  -r, --rpc-url string        RPC URL to use

Use "xmtpd-cli [command] --help" for more information about a command.

@fbac fbac requested a review from a team as a code owner June 9, 2025 15:54
@graphite-app
Copy link

graphite-app bot commented Jun 9, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • Queue - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@fbac fbac force-pushed the 06-07-cobra_cli branch from c4d2130 to e242275 Compare June 9, 2025 15:54
@macroscopeapp
Copy link

macroscopeapp bot commented Jun 9, 2025

Add new xmtpd-cli command-line tool based on spf13/cobra for managing XMTP network node registry and rate registry operations

Creates a new command-line interface tool xmtpd-cli built with the Cobra framework that provides administrative commands for managing XMTP network operations. The implementation includes:

  • Key management commands in cmd/xmtpd-cli/commands/key_management.go for generating ECDSA key pairs and retrieving public keys from private keys
  • Node registry management commands in cmd/xmtpd-cli/commands/node_registry.go for registering nodes, managing canonical networks, and updating node configurations
  • Rate registry management commands in cmd/xmtpd-cli/commands/rate_registry.go for adding and retrieving fee rates including message, storage, and congestion fees
  • Root command structure in cmd/xmtpd-cli/commands/root.go with global configuration options and logging setup
  • Updates to INodeRegistryAdmin.AddNode method signature to return node ID alongside error
  • Modification of migrator.WriteToRegistry function to accept context parameter instead of logger and handle canonical network node additions

📍Where to Start

Start with the main entry point in cmd/xmtpd-cli/main.go and then examine the root command setup in cmd/xmtpd-cli/commands/root.go to understand the overall CLI structure.


Macroscope summarized b3211d7.

Short: "Register a node",
Run: registerNodeHandler,
Example: `
Usage: xmtpd nodes register --owner-address <address> --signing-key-pub <key> --http-address <address> [--force]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cli command tends to be xmtpd-cli or maybe we need a different name. But historically it has not been xmtpd

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixing it.

Copy link
Collaborator

@mkysel mkysel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning on having the CLIs live concurrently while developing and then purging the old one?

@fbac
Copy link
Collaborator Author

fbac commented Jun 9, 2025

Are you planning on having the CLIs live concurrently while developing and then purging the old one?

I think It would be nice to live concurrently until we make sure they have the same features and there are no major problems, then we can make the switch.

Borja Aranda and others added 5 commits June 9, 2025 20:50
### Modify `AddNode` method to return node ID and update
`WriteToRegistry` to accept context parameter for migrator cleanup
- The `AddNode` method in `INodeRegistryAdmin` interface now returns a
`uint32` node ID in addition to an error, with the implementation
capturing the node ID from the `NodeAdded` event in
[pkg/blockchain/registryAdmin.go](https://github.com/xmtp/xmtpd/pull/881/files#diff-d2eeb0eee280c4bdf2aa11a0222e19583a009cbd7aa6ee4fa791be3a892b43d9)
- The `WriteToRegistry` function in
[pkg/blockchain/migrator/migrator.go](https://github.com/xmtp/xmtpd/pull/881/files#diff-bc12b88012e6220f18d02533f0643cca1daf3bf6e6e7021ee4489208e28479d7)
now accepts a context parameter instead of a logger and adds nodes to
the canonical network when the `InCanonicalNetwork` flag is true
- All callers of `AddNode` and `WriteToRegistry` have been updated to
handle the new function signatures in
[cmd/cli/main.go](https://github.com/xmtp/xmtpd/pull/881/files#diff-ed4d81d29a7267f93fd77e17993fd3491b9ef6ded18490b4514d10ed1d803bc2),
test files, and related components

#### 📍Where to Start
Start with the `AddNode` method implementation in the
`nodeRegistryAdmin` struct in
[pkg/blockchain/registryAdmin.go](https://github.com/xmtp/xmtpd/pull/881/files#diff-d2eeb0eee280c4bdf2aa11a0222e19583a009cbd7aa6ee4fa791be3a892b43d9)
to understand the core interface change.

----

_[Macroscope](https://app.macroscope.com) summarized 525f5cc._
@fbac fbac force-pushed the 06-07-cobra_cli branch from c1fed4b to 934cf8f Compare June 9, 2025 20:55
@fbac fbac force-pushed the 06-07-cobra_cli branch from 934cf8f to efb3124 Compare June 9, 2025 21:02
@fbac fbac force-pushed the 06-07-cobra_cli branch from efb3124 to b3211d7 Compare June 9, 2025 21:12
@fbac fbac merged commit e852398 into main Jun 9, 2025
9 checks passed
@fbac fbac deleted the 06-07-cobra_cli branch June 9, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants