The ibc-proto-compiler
is a simple command-line tool to automate the compilation of Protocol Buffers message definitions from the Cosmos SDK and IBC-Go to Rust source code with Prost, for use in the ibc-proto
crate in the ibc-rs
project.
From within the proto-compiler
directory, compile the binary using the --locked
flag:
cargo build --locked
Run the following command to clone the Cosmos SDK and the IBC-Go repositories, and check out a specific commit:
cargo run -- clone --out /tmp/cosmos --sdk-commit b75c29fc15d3320ec0c7596dbd7c787c48dccad8 --ibc-go-commit 7cd110e8e58b84a283af8abe0af6eade6a0126b9
Note:
- the full commit hash must be specified
- the option
--ibc-go-commit
is not mandatory: if skipped, then the IBC go repository is omitted. - ideally make sure the target directory
/tmp/cosmos
is empty
Alternatively, one can check out a tag for the Cosmos SDK with the --sdk-tag
option:
cargo run -- clone --out /tmp/cosmos --sdk-tag v0.44.3 --ibc-go-commit 7cd110e8e58b84a283af8abe0af6eade6a0126b9
To generate the Rust sources from the Protobuf definitions, and copy them to the src/prost
folder ibc-proto
crate within the ibc-rs
project:
cargo run -- compile --sdk /tmp/cosmos/sdk --ibc /tmp/cosmos/ibc --out ../proto/src/prost
Note: the --ibc
option is not mandatory; if omitted, then the IBC .proto files from the SDK repository will be used