-
Notifications
You must be signed in to change notification settings - Fork 111
Fix: Resolve protobuf generation bloat with sparse mode filtering #1525
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: master
Are you sure you want to change the base?
Changes from 1 commit
13c02d5
2b64e59
e0cc58c
8e0eead
a079d62
cb614fe
1ca3399
4f9cad6
4d2ddf2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,29 +1,55 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # this script checks out mayanode master and generates the proto3 typescript buindings for MsgDeposit and MsgSend | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # This script updates MAYAChain Protobuf bindings for MsgDeposit and MsgSend | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| MSG_COMPILED_OUTPUTFILE=src/types/proto/MsgCompiled.js | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| MSG_COMPILED_TYPES_OUTPUTFILE=src/types/proto/MsgCompiled.d.ts | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| TMP_DIR=$(mktemp -d) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| tput setaf 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Checking out https://gitlab.com/mayachain/mayanode to $TMP_DIR" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Checking out https://gitlab.com/mayachain/mayanode to $TMP_DIR" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| tput sgr0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| (cd $TMP_DIR && git clone https://gitlab.com/mayachain/mayanode) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| (cd "$TMP_DIR" && git clone https://gitlab.com/mayachain/mayanode) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Generate msgs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Verify proto files exist | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| tput setaf 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Checking proto files" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| tput sgr0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ls "$TMP_DIR/mayanode/proto/mayachain/v1/common/common.proto" || echo "common.proto missing" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ls "$TMP_DIR/mayanode/proto/mayachain/v1/x/mayachain/types/msg_deposit.proto" || echo "msg_deposit.proto missing" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ls "$TMP_DIR/mayanode/proto/mayachain/v1/x/mayachain/types/msg_send.proto" || echo "msg_send.proto missing" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Download cosmos/base/v1beta1/coin.proto from cosmossdk if needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ ! -f "$TMP_DIR/mayanode/third_party/proto/cosmos/base/v1beta1/coin.proto" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| tput setaf 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Downloading cosmos/base/v1beta1/coin.proto from cosmossdk" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| tput sgr0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p "$TMP_DIR/mayanode/third_party/proto/cosmos/base/v1beta1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| curl -o "$TMP_DIR/mayanode/third_party/proto/cosmos/base/v1beta1/coin.proto" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "https://raw.githubusercontent.com/cosmos/cosmos-sdk/main/proto/cosmos/base/v1beta1/coin.proto" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Download cosmos/base/v1beta1/coin.proto from cosmossdk if needed | |
| if [ ! -f "$TMP_DIR/mayanode/third_party/proto/cosmos/base/v1beta1/coin.proto" ]; then | |
| tput setaf 2 | |
| echo "Downloading cosmos/base/v1beta1/coin.proto from cosmossdk" | |
| tput sgr0 | |
| mkdir -p "$TMP_DIR/mayanode/third_party/proto/cosmos/base/v1beta1" | |
| curl -o "$TMP_DIR/mayanode/third_party/proto/cosmos/base/v1beta1/coin.proto" \ | |
| "https://raw.githubusercontent.com/cosmos/cosmos-sdk/main/proto/cosmos/base/v1beta1/coin.proto" | |
| fi | |
| # Download cosmos/base/v1beta1/coin.proto from cosmossdk if needed | |
| COSMOS_COIN_PROTO="$TMP_DIR/mayanode/third_party/proto/cosmos/base/v1beta1/coin.proto" | |
| if [ ! -f "$COSMOS_COIN_PROTO" ]; then | |
| tput setaf 2 | |
| echo "Downloading cosmos/base/v1beta1/coin.proto from cosmossdk" | |
| tput sgr0 | |
| mkdir -p "$(dirname "$COSMOS_COIN_PROTO")" | |
| if ! curl -fSL --retry 3 --retry-delay 2 -o "$COSMOS_COIN_PROTO" \ | |
| "https://raw.githubusercontent.com/cosmos/cosmos-sdk/main/proto/cosmos/base/v1beta1/coin.proto"; then | |
| echo "Error: Failed to download cosmos coin.proto" | |
| exit 1 | |
| fi | |
| echo "✓ Downloaded cosmos coin.proto" | |
| else | |
| echo "✓ cosmos coin.proto already exists" | |
| fi |
🤖 Prompt for AI Agents
In packages/xchain-mayachain/genMsgs.sh around lines 23 to 31, harden the
coin.proto download: use curl with -f -L -S and retry flags (e.g., --retry and
--retry-delay) so HTTP errors and redirects fail fast and retry, write to a
temporary file and only move it into place on successful curl to avoid partial
files, remove any temp file on failure, check curl's exit code and exit the
script non-zero on failure, and update the echo/tput messages to clearly report
success or the HTTP/error returned.
Uh oh!
There was an error while loading. Please reload this page.