Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): canonicalize keystore path (#19312)
## Description Fix a bug where a relative keystore path was written out to the config upon creation when the config itself was specified at a relative path. The fix is to canonicalize the keystore path before using it, but we need to handle multiple edge cases: - A wallet config created in the current working directory as a relative path (and relative paths in general). - A wallet config created at the very root of the filesystem (although this should never happen, the correct behaviour is not to default to the default config directory here). ## Test plan ``` sui$ cargo build --bin sui sui$ export SUI=~/sui/target/debug/sui sui$ mv ~/.sui/sui_config/client.yaml{,~} sui$ cd ~ # Create the config at the default location using a relative path sui$ $SUI client --client.config .sui/sui_config/client.yaml gas sui$ cd - sui$ $SUI client gas # Create the config at some other location, using a relative path sui$ mkdir -p /tmp/a sui$ cd /tmp/a a$ $SUI client --client.config ./client.yaml gas a$ cd - sui$ $SUI client --client.config /tmp/a/client.yaml gas # Create the config at some other location, using a relative path # without a root sui$ mkdir -p /tmp/b sui$ cd /tmp/b b$ $SUI client --client.config client.yaml gas b$ cd - sui$ $SUI client --client.config /tmp/b/client.yaml gas ``` --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [x] CLI: Fixes a bug where the CLI would write out a config with a relative path for the keystore that would only work if the CLI was subsequently called from the same directory that the config was first created in. - [ ] Rust SDK: - [ ] REST API:
- Loading branch information