-
Notifications
You must be signed in to change notification settings - Fork 355
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
Add --build-tonic
flag to proto-compiler, sync protobuf script, and generate protobuf for std and no_std mode
#1439
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.
Very nice! Thanks for including the script as well, which allows us to skip the slow libgit2 clone
step and call compile
directly :)
@adizere @soareschen Do we want to include this in 0.8.0? |
I think this should be merged after we switched to the official versions of
|
Leaving this as draft until it gets prioritized again. |
a08566b
to
1129c43
Compare
ci/sync-protobuf.sh
Outdated
COSMOS_SDK_GIT=${COSMOS_SDK_GIT:-/tmp/cosmos-sdk.git} | ||
IBC_GO_GIT=${IBC_GO_GIT:-/tmp/ibc-go.git} |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
Ah, I've read further to understand that these are just mirrors and they are fetched from the remote every time the script is invoked. Still, the point about trusting well-known file paths in /tmp
stands. Maybe mirror these repos under ${XDG_CACHE_HOME:-$HOME/.cache}/ibc-rs.build
?
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.
That could work as well. Compared to the original, we want to use a local git bare repository as cache instead of trying to clone the entire remote repository every time the command is run.
Right now I still have the problem that if a bare repository has already been cloned before, I can't find simple way to update it other than having to reclone the entire bare repository. So it is still a little problematic to set a persistent location at $HOME
by default.
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.
Use of non-randomized paths in /tmp
also assumes that only a single user will ever run this script (over the host's uptime before /tmp
is cleared). This is probably OK for a typical developer's workstation, but using a location at $HOME
by convention gives you better isolation.
Right now I still have the problem that if a bare repository has already been cloned before, I can't find simple way to update it
I've tried locally and git fetch
or git fetch origin
seem to work. What's the problem?
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've tried locally and
git fetch
orgit fetch origin
seem to work. What's the problem?
Hmm I might have cloned the bare repository inappropriately. That seems to work now!
I have updated the script as you suggested. It stores the git cache at ~/.cache/cosmos
.
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 stores the git cache at
~/.cache/cosmos
.
This might conceivably clash with some Cosmos client in the future (or just an unrelated app named cosmos
), I'd rather use something identifying the ibc-rs build scripts as the well-known directory under ~/.cache
and put everything cached by the scripts in there. But this is mostly pedantry, thanks for fixing the main issue.
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 would be preferable to merge this after #1582.
Not sure what our merge strategy could be to help prevent regressions or problems, since manually reviewing it is impossible. Any thoughts?
@@ -0,0 +1,2538 @@ | |||
# This file is automatically @generated by Cargo. | |||
# It is not intended for manual editing. | |||
version = 3 |
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.
Do we need to maintain this file under revision?
Are we ready to merge this? |
Needs a merge from master at least. |
… generate protobuf for std and no_std mode (informalsystems#1439) * Generate std and no_std versions of protobuf * Improve sync protobuf script and Cargo.toml * Re-sync protobuf files * Move sync-protobuf.sh to scripts/
Part of #1158
Description
--build-tonic
flag toproto-compiler
to allow generation of protobuf definitions without tonic client for no_std.ci/sync-protobuf.sh
script to reliably re-generate the protobuf Rust definitions. Note however that the currentprotobuf-compiler
is non-reproducible, so multiple calls toci/sync-protobuf.sh
may yield different results.std
feature flag inibc-proto
to includetonic
as dependency when activated.ibc-proto
load protobuf definitions from eitherproto/src/prost/std
orproto/src/prost/no_std
depending on thestd
feature flag.proto-compiler
being non-reproducible makes it difficult to check the diff and verify that there is indeed no changes in the generated files.For contributor use:
unclog
.docs/
) and code comments.Files changed
in the Github PR explorer.