forest icon indicating copy to clipboard operation
forest copied to clipboard

Improve `forest-tool api serve` ergonomics

Open elmattic opened this issue 1 year ago • 0 comments

Issue summary

Our api serve subcommand is erasing its snapshot input, once finishing to serve RPC calls. Dito with the flag --data-dir.

But none of this is documented:

$ ./forest-tool api serve -h
Usage: forest-tool api serve [OPTIONS] [SNAPSHOT_FILE]

Arguments:
  [SNAPSHOT_FILE]  Snapshot input paths. Supports `.car`, `.car.zst`, and `.forest.car.zst`

Options:
      --chain <CHAIN>           Filecoin network chain [default: mainnet]
      --port <PORT>             [default: 2345]
      --data-dir <DATA_DIR>     [default: offline-rpc-db]
      --auto-download-snapshot  
  -h, --help                    Print help

This is a bit surprising, so we should either:

  • Document it in the command help
  • Ask the user if that's ok
  • Don't erase it and handle the cleaning part in our scripts

The latter choice would make more sense. You often want to reuse a snapshot and avoid downloading a new one or making a defensive copy.

Other information and links

https://github.com/ChainSafe/forest/blob/main/src/tool/subcommands/api_cmd.rs#L892-L894

elmattic avatar Feb 16 '24 13:02 elmattic