-
Notifications
You must be signed in to change notification settings - Fork 283
feat(kagami wasm): move --profile into --cargo-args #5493
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
base: main
Are you sure you want to change the base?
feat(kagami wasm): move --profile into --cargo-args #5493
Conversation
--profile into --cargo-args--profile into --cargo-args
d3e51d5 to
b78fad4
Compare
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.
Hey, thank you for opening the PR!
This seems to be the right direction. Notes:
- If user provides
--profile, let's print a warning witheprintln!likewarn: "--profile" arg is deprecated; please use "--cargo-args='--profile ..'" instead - If there is a conflict between
--profileand--cargo-args(which you handle), print another warning in addition, likewarn: value from "--profile" is ignored in favor of profile in "--cargo-args" - Please add unit tests for args parsing (there are some existing ones), ensuring the behaviour
--profile into --cargo-argsb78fad4 to
522d852
Compare
|
Hey, I’ve added the tests and logs you suggested, and also refactored some code to avoid unnecessary allocations. Does the change from Please let me know if you'd like me to change anything. |
|
Hey, this works, but I just realized I could have done it a bit better using |
crates/iroha_kagami/src/wasm.rs
Outdated
| #[arg(long, default_value = "release")] | ||
| profile: Profile, | ||
| #[arg(long)] | ||
| profile: Option<Profile>, |
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.
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 agree. Not accepting the deprecated argument would simplify the implementation and improve maintainability.
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.
This is not an entirely internal tool, and is intended for users to help them build their smartcontracts.
Practically, yes, I would not insist on keeping the backward compatibility in our circumstances.
Ideologically, I would say that it is a good manner to keep it, especially if it's not too costly. We have a habit of breaking everything all the time while finding some excuses for it, and I don't think it is a good habit.
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 acknowledge that my response was somewhat hasty. Indeed, kagami wasm is intended for use not only by internal developers but also by contributors, node operators, and trigger/smart-contract developers.
I believe the root cause of this dispute is that we released the RCs before the specifications were truly finalized, which has forced us into a dilemma: whether to support backward compatibility at the expense of development velocity, or to ignore backward compatibility and risk breaking the interface.
Both options involve trade‑offs, but I would prioritize a proper RC release and opt for the latter.
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 am fine with both, so let's not care about backwards compatibility and just remove the --profile arg.
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.
Please let us know what you think @Levi0804
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.
@s8sato Sorry for the delayed response. I’m good with either, but since there’s already a "cargo args" argument, moving profile there might be better.
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.
Then, could you please update the PR and remove the dedicated --profile argument? (and passing it into --cargo-args where used)
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.
@0x009922 I have removed the dedicated --profile argument. Do these changes look good?
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.
Yes, thanks!
|
Hello, I've updated the code to use the |
Also, I don't think this will be possible because |
f95912f to
893e543
Compare
|
Hello, do these changes look good? |
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.
It seems we’re divided on whether to retain the deprecated --profile option outside of --cargo-args (#5493 (comment)). I expect we can resume the discussion next Tuesday.
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.
LGTM.
Though, I now see that the internal Profile in iroha_wasm_builder is somewhat opinionated. It isn't necessary that WASMs are built either with release or deploy profile (this one is even specific to our repo). I'd propose to remove any notion of Profile entirely, as well as handling of the --profile argument in --cargo-args. But that's for a separate PR.
|
yeah, I see.
then will they all just default to release? |
Hmm, not sure. Actually, I've looked into the how |
Signed-off-by: Levi0804 <[email protected]>
Signed-off-by: Levi0804 <[email protected]>
Signed-off-by: Levi0804 <[email protected]>
Signed-off-by: Levi0804 <[email protected]>
6e9fa39 to
4ace70a
Compare
Overview
This PR handles #5453, moving the
--profileargument to--cargo-argsand handling the case where the--profileargument is given multiple times.Changes
Args::Buildhandler branch to prioritize--profileargument inside--cargo-args, ignoring the other--profileargument (default or if any).build_wasm.shto use--carg-args.