The repo's proto-gen was non-idempotent and the committed *.pb.go had drifted from the .proto sources across 5 modules (docs/known-issues/proto-generated-drift.md). Root causes: 1. scripts/sync-generated-go-pb.sh left buf's ./clawchain staging tree in place, creating a duplicate Go package that broke 'go build ./...' and made every regen non-idempotent. Fixed by 'rm -rf clawchain' after the copy. 2. .gitignore 'clawchain/' over-matched proto/clawchain/, so the proto SOURCES were never tracked and drifted freely (the gitignore trap). Added a targeted negation; the root buf-staging clawchain/ stays ignored. Versioned all 47 proto sources (27 were untracked). Reconciliation (proto = source of truth, matched to code the chain actually uses): - modelregistry tx.proto: re-added MsgRegisterModel.price_subscription_uclaw(16) + subscription_period_blocks(17) (used by grpc_msg_server); removed unimplemented P4 MsgSubmitUsageAttestation/MsgDisputeInferenceJob (no keeper/codec, absent from pb.go). - modelregistry types.proto: removed unused InferenceJob fields 18-23; kept Model 25/26. - Deleted hand-written stopgap types/msg_renew_subscription.go (regen produces the struct); removed module/depinject.go ProvideCustomGetSigners (regenerated type carries the signer annotation; the custom getter panicked at startup — caught by TestNewApp). - Regenerated governance/messaging/reputation/oracle pb.go (descriptor/accessor-level). Verified: make proto-gen idempotent (byte-identical on re-run, no stray dir, no new untracked), go build ./... clean, go test ./... 30 ok / 0 FAIL.
26 lines
719 B
Bash
Executable File
26 lines
719 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SRC_ROOT="clawchain/x"
|
|
DST_ROOT="x"
|
|
|
|
if [ ! -d "$SRC_ROOT" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
while IFS= read -r -d '' src_file; do
|
|
rel_path="${src_file#${SRC_ROOT}/}"
|
|
dst_file="${DST_ROOT}/${rel_path}"
|
|
dst_dir="$(dirname "$dst_file")"
|
|
mkdir -p "$dst_dir"
|
|
cp "$src_file" "$dst_file"
|
|
done < <(find "$SRC_ROOT" -type f \( -name '*.pb.go' -o -name '*.pb.gw.go' \) -print0)
|
|
|
|
# Remove the buf staging tree. buf generates into ./clawchain/... (the proto
|
|
# go_package path) and we copy the files into ./x/...; the leftover ./clawchain
|
|
# tree is a duplicate Go package that breaks `go build ./...` and makes
|
|
# proto-gen non-idempotent. Drop it once the copy is done.
|
|
rm -rf clawchain
|
|
|
|
exit 0
|