-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli): canonicalize keystore path #19312
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 ```
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
giac-mysten
approved these changes
Sep 11, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @amnn!
suiwombat
pushed a commit
that referenced
this pull request
Sep 16, 2024
## 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:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Test plan
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.