Skip to content
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

Issue with --dump-bytecode-as-base64 Option Requiring Config File #20458

Closed
daoauth opened this issue Nov 28, 2024 · 4 comments · Fixed by #20475
Closed

Issue with --dump-bytecode-as-base64 Option Requiring Config File #20458

daoauth opened this issue Nov 28, 2024 · 4 comments · Fixed by #20475
Assignees
Labels
cli Command line tools

Comments

@daoauth
Copy link
Contributor

daoauth commented Nov 28, 2024

Steps to Reproduce Issue

  1. Update sui-cli to the latest version.
  2. Run the following command without a configuration file present:
sui move build --dump-bytecode-as-base64
  1. Observe the following prompt:
Config file ["client.yaml"] doesn't exist, do you want to connect to a Sui Full node server [y/N]?

Expected Result

The --dump-bytecode-as-base64 option should function as it did in previous versions of sui-cli, where it could generate a dump file without requiring a configuration file.

Actual Result

The command fails to execute and prompts the user for a configuration file:

Config file ["client.yaml"] doesn't exist, do you want to connect to a Sui Full node server [y/N]?

This introduces a new and unexpected dependency on a config file, which complicates workflows that previously operated without it.

System Information

  • OS: mac os. github actions
@stefan-mysten
Copy link
Contributor

stefan-mysten commented Nov 29, 2024

Hi @daoauth

We're aware of this little inconvenience with the sui move build --dump-bytecode-as-base64. It basically just needs to know which network you're trying to build against, so you can provide a dummy client.yaml file without actually creating a private key and the sui.keystore file, and that will work. The reason for that is related to the needs of automated address management.

I will try to see if I can fix this for a next release of Sui CLI, to have a flag that we can pass an unknown chain and just allow us to build the code and get the json from this dump-bytecode-as-base64.

@daoauth
Copy link
Contributor Author

daoauth commented Nov 30, 2024

Hi @daoauth

We're aware of this little inconvenience with the sui move build --dump-bytecode-as-base64. It basically just needs to know which network you're trying to build against, so you can provide a dummy client.yaml file without actually creating a private key and the sui.keystore file, and that will work. The reason for that is related to the needs of automated address management.

I will try to see if I can fix this for a next release of Sui CLI, to have a flag that we can pass an unknown chain and just allow us to build the code and get the json from this dump-bytecode-as-base64.

Could you kindly consider this issue as well? If possible, I would greatly appreciate your thoughts on it.

@stefan-mysten
Copy link
Contributor

Sorry but I don't think such a feature is needed. --dump-bytecode-as-base64 returns a JSON, so you need to just pipe it to a file using standard unix utils? Is that something not possible on your end?

@daoauth
Copy link
Contributor Author

daoauth commented Nov 30, 2024

Sorry but I don't think such a feature is needed. --dump-bytecode-as-base64 returns a JSON, so you need to just pipe it to a file using standard unix utils? Is that something not possible on your end?

I've already been saving the JSON as you suggested, and it's not a major issue. However, when I use a pipeline to output, the color of the compile result prompt disappears, which is a bit unfortunate. In my thought, this happens because ANSI color codes are disabled when output is redirected to a file or pipeline.

I understand this isn't an urgent or essential matter, but I wanted to mention it to see if there's any other solution or if a feature could be added to address this.

@daoauth daoauth closed this as completed Dec 1, 2024
stefan-mysten added a commit that referenced this issue Dec 2, 2024
…uild` (#20475)

## Description 

Allow `sui move build --dump-bytecode-as-base64` to not need to read the
chain from `client.yaml` by adding a flag `--ignore-chain`. This allows
building to proceed without a network connection or active environment,
but it will not be able to automatically determine the addresses of its
dependencies.
NB: `--ignore-chain` depends on `dump-bytecode-as-base64`, so it cannot
be used on its own.

Should close #20458.

## Test plan 

Local test.
```
➜  first_package git:(main) ✗ sui move build --dump-bytecode-as-base64 --ignore-chain
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING my_first_package
JSON_OUTPUT_HERE - replaced for brevity.
➜  first_package git:(main) ✗ sui move build --dump-bytecode-as-base64
Config file ["/Users/user/.sui/sui_config/client.yaml"] doesn't exist, do you want to connect to a Sui Full node server [y/N]?
```
---
## 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: Added the flag `--ignore-chain` that works together with `sui
move build --dump-bytecode-as-base64` to bypass the need for a
`client.yaml` file. This allows building to proceed without a network
connection or active environment, but it will not be able to
automatically determine the addresses of its dependencies. NB:
`--ignore-chain` depends on `--dump-bytecode-as-base64`, so it cannot be
used on its own.
- [ ] Rust SDK:
- [ ] REST API:

---------

Co-authored-by: Ashok Menon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Command line tools
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants