-
Notifications
You must be signed in to change notification settings - Fork 2
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
Prepare test CLI for use in Programs repo #856
Conversation
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.
Fine by me. Im not sure how you will be able to use this in a different way than it is used here with only the run_command
fn being public. But i guess if other stuff needs to be public you will figure that out at the point of needing it.
main.rs
should have a license header.
@JesseAbram Do you mind elaborating on the motivation a bit here? We can probably build some features for interacting with programs here first before It's also unclear from the diff or commits what "few extras" you added, do you mind |
well really all we need is store program, and we can make changes to it to fit the programs cli better, im thinking we pass an option into run command that can be passed down the line for program file (so we can make it easier to pass compiled files), other than that everything works the same as it is now |
like my comment says we currently maintain two cli that do the same thing, one here and one in the programs repo, we can now merge them because core was opened. cli
we do, we have store program, and that is really all we need for the programs repo
Handling of the mnemonic also now includes allowing it to be in a .env instead of passed in. As well we can pass in a program aux data and config to the run_command function so we can handle getting the data automatically from the template |
To go deeper on this train of though, why not maintain the programs related functionality in this CLI instead of pulling all the "core" stuff into the Programs CLI? That way we can still maintain one CLI.
Similar to my point above, we make the test CLI the only tool for now.
Okay cool. Next time do you mind splitting that out into its own commit(s) to make it easier for review 🙏 |
a few reasons, one is because the testcli serves as an internal testing tool and forces us to maintain it by deafult in core, as in if we make a change to core we have to fix the cli instead of maybe remembering and seeing we broke it later down the line. As well the cli in the programs repo requires really only one of the functions so I mean it would be weird to put all the extra stuff we need. Down the road I hope the cli will also be used by validators if they need to do functions on their validator, so having it right there in the core makes sense to me. Also I mean it isn't that much stuff, I don't see the issue in pulling it into the programs repo
|
sorry that stuff it already here, and I see what you mean but there are some helpers we can add that really greese the wheels here https://github.com/entropyxyz/programs/pull/83/files#diff-952b6817e3c56099926b7e90cfc8823a75ddfcfc48442217dc6d00e93dc99790R10-R14 plus I mean that extra stuff only gets built when you build the CLI, and stays local (not hosting it anywhere) so in the end you will have to build it anyways, personally I weigh the ease of being able to pull files directly and use the .env config (im not sure it will work if we don;t have it in the root, I could be wrong here tho) as worth it |
I should probably fix this. We only need the dependency Also worth noting that the CLI is just a thin wrapper around |
@JesseAbram having actually tried this out, i am not happy with needing to give the mnemonic as an optional argument when registering or updating programs, as in the context of this CLI it is not optional, which makes this confusing. The readme would also need to be updated. I missed this in the big diff. If you want to be able to read it from an environment variable, you should either read the environment variable inside this CLI, or factor out the bits you need from I think if you need stuff from this CLI for another CLI, you should be to get those things without changing the behavior of this CLI. |
I mean I do, you can add a .env to the repo, I think the .env flow is better for use longterm, but also allows for a mnemonic to be passed in, I default it to //Alice but I can always error it out if none is passed, keeping essentially the same flow |
@@ -179,7 +179,7 @@ pub async fn run_command( | |||
std::env::var("ENTROPY_DEVNET").unwrap_or("ws://localhost:9944".to_string()) | |||
}); | |||
|
|||
let passed_mnemonic = std::env::var("DEPLOYER_MNEMONIC").unwrap_or("//Alice".to_string()); | |||
let passed_mnemonic = std::env::var("DEPLOYER_MNEMONIC"); |
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.
Ok got it this is good, i missed this before and thought passed_mnemonic
was one of the arguments to run_command
.
crates/test-cli/README.md
Outdated
|
||
`entropy-test-cli register Alice public template_barebones.wasm` | ||
`entropy-test-cli register public template_barebones.wasm template_barebones_config_data template_barebones_aux_data //Alice` |
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.
I don't think this will work. Mnemonic is not a positional argument, its an #[arg(short, long)]
which is given with --mnemonic-option //Alice
or -m //Alice
.
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.
good catch
@@ -129,7 +116,7 @@ a program you can use the `store-program` command. | |||
You need to give the account which will store the program, and the path to a program binary file you | |||
wish to store, for example: | |||
|
|||
`entropy-test-cli store-program Alice ./crates/testing-utils/example_barebones_with_auxilary.wasm` | |||
`entropy-test-cli store-program ./crates/testing-utils/example_barebones_with_auxilary.wasm //Alice` |
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.
same here
This allows for it to be used in programs repo to allow us to maintain only one cli. This also adds a few extras I think are nice