feat(autocli): replace pulsar types with Go-native structs (Phase 1 of pulsar removal)#26511
feat(autocli): replace pulsar types with Go-native structs (Phase 1 of pulsar removal)#26511aljo242 wants to merge 8 commits into
Conversation
|
🔒 WARNING: unsigned commits detected This pull request contains 1 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits:
|
|
@aljo242 your pull request is missing a changelog! |
Greptile SummaryPhase 1 of the pulsar removal project: introduces five Go-native structs in
Confidence Score: 1/5Not safe to merge: three files contain invalid Go type expressions that prevent the entire client/v2 autocli package from compiling. Three files — flag/builder.go, msg.go, and query.go — each use the double-qualified form autoclicore.autoclicore.FlagOptions / autoclicore.autoclicore.RpcCommandOptions, which is not valid Go syntax. These map declarations sit on the hot path of every query and message command generation call. The package will not build at all until these are fixed. client/v2/autocli/flag/builder.go, client/v2/autocli/msg.go, and client/v2/autocli/query.go all need the double-qualified package selector corrected before the PR can build. Important Files Changed
|
|
|
||
| // define all other fields as flags | ||
| flagOptsByFlagName := map[string]*autocliv1.FlagOptions{} | ||
| flagOptsByFlagName := map[string]*autoclicore.autoclicore.FlagOptions{} |
There was a problem hiding this comment.
The map value type uses a double-qualified
autoclicore.autoclicore.FlagOptions which is not valid Go and will not compile. The alias autoclicore already refers to the package; the type reference should be autoclicore.FlagOptions.
| flagOptsByFlagName := map[string]*autoclicore.autoclicore.FlagOptions{} | |
| flagOptsByFlagName := map[string]*autoclicore.FlagOptions{} |
| methods := service.Methods() | ||
|
|
||
| rpcOptMap := map[protoreflect.Name]*autocliv1.RpcCommandOptions{} | ||
| rpcOptMap := map[protoreflect.Name]*autoclicore.autoclicore.RpcCommandOptions{} |
There was a problem hiding this comment.
Same double-package-qualifier typo:
autoclicore.autoclicore.RpcCommandOptions is not a valid Go type and will fail to compile. Should be autoclicore.RpcCommandOptions.
| rpcOptMap := map[protoreflect.Name]*autoclicore.autoclicore.RpcCommandOptions{} | |
| rpcOptMap := map[protoreflect.Name]*autoclicore.RpcCommandOptions{} |
| methods := service.Methods() | ||
|
|
||
| rpcOptMap := map[protoreflect.Name]*autocliv1.RpcCommandOptions{} | ||
| rpcOptMap := map[protoreflect.Name]*autoclicore.autoclicore.RpcCommandOptions{} |
There was a problem hiding this comment.
Same double-package-qualifier typo in
query.go: autoclicore.autoclicore.RpcCommandOptions is not valid Go and will cause a compile failure. Should be autoclicore.RpcCommandOptions.
| rpcOptMap := map[protoreflect.Name]*autoclicore.autoclicore.RpcCommandOptions{} | |
| rpcOptMap := map[protoreflect.Name]*autoclicore.RpcCommandOptions{} |
| RpcMethod: o.RpcMethod, | ||
| Use: o.Use, | ||
| Long: o.Long, | ||
| Short: o.Short, | ||
| Example: o.Example, | ||
| Alias: o.Alias, |
There was a problem hiding this comment.
Missing nil guard for
PositionalArgDescriptor slice elements
toProtoRpcOpts iterates o.PositionalArgs and dereferences each element directly, but FlagOptions entries in the same function have an explicit if f == nil { continue } guard. If a nil pointer is ever stored in the PositionalArgs slice, this will panic at runtime. Consider adding the same guard for consistency and safety.
| Service: autocliv1.Query_ServiceDesc.ServiceName, | ||
| RpcCommandOptions: []*autocliv1.RpcCommandOptions{ | ||
| // cosmos.autocli.v1.Query | ||
| Service: "cosmos.autocli.v1.Query", |
There was a problem hiding this comment.
Hardcoded service name string loses compile-time safety
The original code used autocliv1.Query_ServiceDesc.ServiceName, which is guaranteed by the proto-generated descriptor to match the actual service name. Replacing it with the raw string "cosmos.autocli.v1.Query" means a typo here won't be caught at compile time — it will silently produce a CLI sub-command that fails at runtime when the gRPC registry lookup finds nothing.
|
🔒 WARNING: unsigned commits detected This pull request contains 2 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits:
|
|
🔒 WARNING: unsigned commits detected This pull request contains 3 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits: |
Introduces five Go-native structs in cosmossdk.io/core/autocli that mirror the autocliv1 proto messages 1:1: ModuleOptions, ServiceCommandDescriptor, RpcCommandOptions, FlagOptions, PositionalArgDescriptor All 33 module autocli.go files now import cosmossdk.io/core/autocli instead of cosmossdk.io/api/cosmos/autocli/v1. The autocli engine in client/v2 also uses these types internally. The only remaining usage of the pulsar autocliv1 package is runtime/services/autocli.go, which implements the cosmos.autocli.v1.Query gRPC endpoint — it converts Go-native options to proto at that boundary via toProtoModuleOptions. This is Phase 1 of the pulsar removal project. After this: - 35 → 2 files import cosmossdk.io/api/cosmos/autocli/v1 - cosmossdk.io/api is no longer needed by any module autocli.go file - The gRPC endpoint boundary conversion is explicit and localized Phase 2 (x/tx SignMode), Phase 3 (reflection/msg/amino protos), and Phase 4 (delete ./api) are separate follow-up PRs. Issue: N/A
…e 2)
Defines signing.SignMode as a standalone int32 type in x/tx/signing with
identical values to the proto enum so that x/tx no longer needs to import
cosmossdk.io/api/cosmos/tx/signing/v1beta1 for its public interface.
A type alias was attempted first but is blocked by an import cycle:
x/tx/signing → types/tx/signing → codec/types → x/tx/signing
The standalone type avoids this entirely; conversion to/from the
gogoproto types/tx/signing.SignMode is a plain integer cast.
Changes:
- x/tx/signing: new sign_mode.go defines SignMode + constants + String()
- x/tx/signing/{handler_map,sign_mode_handler,aminojson,direct,directaux}:
drop signingv1beta1 import, use local SignMode
- x/auth/signing/verify.go: conversion functions simplified to casts
- client/cmd.go, client/v2/autocli/keyring, crypto/keyring/autocli.go:
import x/tx/signing instead of cosmossdk.io/api
Deferred to Phase 3 (pulsar Tx type replacement):
- x/auth/tx/adapter.go: bridges gogoproto↔pulsar Tx; still needs
signingv1beta1.SignMode for the ModeInfo_Single.Mode field
- x/tx/signing/textual/tx.go and testutil/util.go: build pulsar
ModeInfo_Single structs; same dependency
After Phase 1+2: cosmossdk.io/api/cosmos/autocli/v1 down to 2 files,
cosmossdk.io/api/cosmos/tx/signing/v1beta1 down to ~3 files.
Issue: N/A
…hase 3) cosmos/reflection/v1 (4 files → 0): - New runtime/services/reflection package hand-writes the gRPC stub for cosmos.reflection.v1.ReflectionService without the pulsar dependency. Provides ServiceServer interface, UnimplementedServiceServer, RegisterReflectionServiceServer, and the grpc.ServiceDesc. - runtime/services/reflection.go, runtime/services.go, runtime/autocli.go, simapp/app.go updated to use the new package. cosmos/msg/v1 (6 files → 2): - types/msgservice/extensions_v2.go adds *protoimpl.ExtensionInfo instances (E_ServiceV2, E_SignerV2) that are compatible with the protov2 API (google.golang.org/protobuf/proto.HasExtension / GetExtension). The gogoproto msg.pb.go E_Service/*ExtensionDesc does NOT satisfy protoreflect.ExtensionType so it cannot be used with the protov2 API. - types/module/configurator.go, types/msgservice/validate.go, runtime/services/autocli.go, client/v2/autocli/flag/builder.go updated to use E_ServiceV2 / E_SignerV2. - x/tx/signing/context.go and x/tx/signing/textual/tx.go deferred — importing types/msgservice from x/tx/signing creates a cycle (x/tx/signing → types/msgservice → x/tx/signing). Will address in Phase 4 with the pulsar Tx type removal. Also: add replace cosmossdk.io/client/v2 directives to modules that need the local version after Phase 2's SignMode interface change. Issue: N/A
8d89f30 to
3f062e7
Compare
|
🔒 WARNING: unsigned commits detected This pull request contains 3 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits: |
…hase 4a)
Replaces cosmossdk.io/api/cosmos/tx/v1beta1.SignDoc with the gogoproto-
generated github.com/cosmos/cosmos-sdk/types/tx.SignDoc in the
SIGN_MODE_DIRECT handler. SignDoc has only scalar fields (bytes, string,
uint64) so gogoproto.Marshal produces the same deterministic bytes as
proto.MarshalOptions{Deterministic:true}.Marshal.
Remaining txv1beta1 usage is architecturally blocked by the decode
pipeline:
- decode/decode.go: needs ProtoReflect().Descriptor() for
RejectUnknownFieldsStrict
- tx_data.go / directaux: TxData.Body.Messages is []*anypb.Any;
anyutil.Unpack requires *anypb.Any specifically
- adapter.go / testutil / aux_builder: build TxData or SignerInfo that
depend on the above types
Also removes the now-unused txsigning import from client/cmd.go (the
SIGN_MODE_TEXTUAL check it guarded was removed by #26456).
Issue: N/A
|
🔒 WARNING: unsigned commits detected This pull request contains 4 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits:
|
…signing path (Phase 4)
Replaces all pulsar Tx types in the signing pipeline with Go-native structs
and gogoproto types, eliminating import cycles while retaining correctness.
core/tx_data.go changes:
- TxData.Body: *txv1beta1.TxBody → *TxBodyData (new Go-native struct)
- TxData.AuthInfo: *txv1beta1.AuthInfo → *TxAuthInfoData (new Go-native struct)
- RawMsg{TypeUrl, Value} replaces *anypb.Any in Messages slices
- TxFeeData/TxCoinData replace pulsar coin types
- Avoids import cycles: any type in x/tx/signing that imports types/tx would
create the cycle x/tx/signing→types/tx→codec/types→x/tx/signing
x/tx/decode:
- Replaces ProtoReflect().Descriptor() with protoregistry.GlobalTypes lookup
(gogoproto's init() populates protoregistry.GlobalTypes via proto.RegisterType)
- Uses gogoproto.Unmarshal for TxRaw/TxBody/AuthInfo → *txtypes.TxRaw/TxBody/AuthInfo
- DecodedTx.Tx: *v1beta1.Tx → *txtypes.Tx; DecodedTx.TxRaw: *v1beta1.TxRaw → *txtypes.TxRaw
- Converts gogoproto Any to *anypb.Any inline for anyutil.Unpack
x/tx/signing:
- unknown_fields.go: moved from x/tx/decode to break the decode→aminojson→decode cycle
x/tx/decode now delegates to signing.RejectUnknownFields/RejectUnknownFieldsStrict
- sign_mode.go: standalone SignMode type (Phase 2, already present)
x/tx/signing/directaux:
- Uses txtypes.SignDocDirectAux + gogoproto.Marshal (no pulsar needed for scalar-only message)
- getFirstSigner converts RawMsg → *anypb.Any for anyutil.Unpack inline
x/tx/signing/aminojson:
- Gets TxBody descriptor via protoregistry.GlobalTypes instead of body.ProtoReflect()
- Converts []RawMsg → []*anypb.Any for AminoSignDoc.Msgs inline
- Converts []TxCoinData → []*basev1beta1.Coin for AminoSignFee.Amount
(basev1beta1 kept for aminojsonpb.AminoSignFee — internal proto type)
x/auth/tx/adapter.go:
- GetSigningTxData no longer converts gogoproto→pulsar; builds TxBodyData/TxAuthInfoData
directly from the wrapper's gogoproto types
Tests updated across:
- x/tx/signing/aminojson, directaux, direct, testutil
- x/auth/migrations/legacytx, x/authz
Deferred (cycle-blocked or larger refactor):
- client/tx/aux_builder.go: body *txv1beta1.TxBody internal state (can be fixed
since client/tx→types/tx creates no cycle; larger setter-method refactor)
- x/tx/signing/context.go: msgv1.E_Signer (x/tx/signing→types/msgservice cycle)
Result: cosmos/tx/v1beta1: 9→1 production file; cosmos/tx/signing/v1beta1: 16→0 ✅
Issue: N/A
|
🔒 WARNING: unsigned commits detected This pull request contains 5 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits:
|
…mports x/tx/signing/msg_extensions.go: - Defines E_Service and E_Signer as *protoimpl.ExtensionInfo directly in the signing package, avoiding import of cosmossdk.io/api/cosmos/msg/v1. The cycle x/tx/signing→types/msgservice→x/tx/signing was the blocker; defining them in-package avoids it entirely. x/tx/signing/context.go: - Replaces msgv1.E_Service and msgv1.E_Signer with the locally-defined equivalents from msg_extensions.go. client/tx/aux_builder.go: - Replaces body *txv1beta1.TxBody with body *txtypes.TxBody (gogoproto). All setters updated: Messages uses []*gogotypes.Any, TimeoutTimestamp uses *time.Time (native gogoproto field type vs *timestamppb.Timestamp). GetSignBytes converts to TxBodyData inline when needed. Result after all phases: cosmos/tx/v1beta1: 0 production files ✅ cosmos/tx/signing/v1beta1: 0 production files ✅ cosmos/msg/v1: 0 production files ✅ cosmos/reflection/v1: 0 production files ✅ cosmos/autocli/v1: 2 production files (gRPC boundary — Phase 5) Issue: N/A
|
🔒 WARNING: unsigned commits detected This pull request contains 6 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits:
|
…ializable core/autocli/options.go: - Adds gogoproto proto tags and proto.Message interface to all 5 types: ModuleOptions, ServiceCommandDescriptor, RpcCommandOptions, FlagOptions, PositionalArgDescriptor. - Adds proto.RegisterType init() calls matching cosmos.autocli.v1.* names. - Types are now directly serializable via gogoproto.Marshal with the same wire format as the pulsar-generated autocliv1 types. runtime/services/autocli_grpc.go (new): - Hand-written gRPC stub for cosmos.autocli.v1.Query without importing cosmossdk.io/api/cosmos/autocli/v1 (pulsar). - AppOptionsRequest (empty), AppOptionsResponse (map[string]*autocli.ModuleOptions), AutoCLIQueryServer interface, UnimplementedAutoCLIQueryServer, RegisterAutoCLIQueryServer, service descriptor and handler. runtime/services/autocli.go: - AutoCLIQueryService now uses AppOptionsResponse directly (no toProtoModuleOptions conversion needed — autocli.ModuleOptions is proto-serializable). - Drops autocliv1 import; uses cosmosmsg.E_ServiceV2 for the service check. runtime/services.go: - Replaces autocliv1.RegisterQueryServer with services.RegisterAutoCLIQueryServer. Result: cosmos/autocli/v1: 0 production files ✅ All major pulsar packages now at 0 production files except cosmos/base/v1beta1. Issue: N/A
|
🔒 WARNING: unsigned commits detected This pull request contains 7 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits:
|
core/coins/format.go:
- Replaces *basev1beta1.Coin and *bankv1beta1.Metadata with local Go
structs: Coin, DecCoin, DenomUnit, Metadata. All have json tags
matching the proto JSON format (denom_units, display, etc.).
- ParseDecCoin added alongside ParseCoin.
- JSON compatibility preserved; existing testdata files work unchanged.
client/v2/internal/coins/format.go:
- ParseCoin and ParseDecCoin now return *coinscore.Coin / *coinscore.DecCoin
from cosmossdk.io/core/coins, eliminating basev1beta1 import.
client/v2/autocli/flag/coin.go and dec_coin.go:
- coinValue and decCoinValue now hold *coinscore.Coin / *coinscore.DecCoin.
- Get() uses dynamicpb.NewMessage from protoregistry.GlobalTypes to build
the protoreflect.Value for cosmos.base.v1beta1.Coin / DecCoin without
importing the pulsar type.
x/tx/signing/aminojson/internal/aminojsonpb/fee.go (new):
- NewAminoSignFee helper hides basev1beta1.Coin construction inside the
internal aminojsonpb package, so aminojson.go no longer imports basev1beta1.
x/bank/autocli.go:
- bankv1beta1.Query_ServiceDesc.ServiceName → "cosmos.bank.v1beta1.Query"
- bankv1beta1.Msg_ServiceDesc.ServiceName → "cosmos.bank.v1beta1.Msg"
client/grpc/cmtservice/autocli.go:
- cmtv1beta1.Service_ServiceDesc.ServiceName → "cosmos.base.tendermint.v1beta1.Service"
client/grpc/node/autocli.go:
- nodev1beta1.Service_ServiceDesc.ServiceName → "cosmos.base.node.v1beta1.Service"
server/mock/tx.go:
- GetMsgsV2: uses dynamicpb.NewMessage("cosmos.bank.v1beta1.MsgSend") to
build the test message without importing bankv1beta1.
Remaining cosmossdk.io/api imports in production code (deferred):
- cosmos/app/v1alpha1 + cosmos/*/module/v1 (depinject) — eliminated by #26493
- aminojson/encoder.go + options.go + aminojsonpb/fee.go — amino extension registration
- tests/integration/rapidgen — dual-type equivalence testing (remove with depinject)
- Various gRPC client query/pagination types and e2e test files
Issue: N/A
|
🔒 WARNING: unsigned commits detected This pull request contains 8 commit(s) without a verified signature. How to fix:
Docs: https://docs.github.com/authentication/managing-commit-signature-verification Unsigned commits:
|
Summary
Phases 1–3 of the pulsar (
cosmossdk.io/api) removal project, rebased on main after #26456 merged.Phase 1 — Go-native AutoCLI types (
core/autocli)Introduces five Go-native structs in a new
cosmossdk.io/core/autoclipackage that mirror theautocliv1proto messages 1:1. All 33 moduleautocli.gofiles now importcosmossdk.io/core/autocliinstead ofcosmossdk.io/api/cosmos/autocli/v1. Onlyruntime/services/autocli.gostill importsautocliv1at the gRPC boundary — it converts Go-native options to proto viatoProtoModuleOptions().35 → 2 files importing
cosmossdk.io/api/cosmos/autocli/v1Phase 2 — Go-native
SignModetype (x/tx/signing)Defines
signing.SignModeas a standaloneint32type inx/tx/signingwith identical values to the proto enum, avoiding a circular import (x/tx/signing → types/tx/signing → codec/types → x/tx/signing). AllSignModeHandlerimplementations and theHandlerMapuse the local type. Thex/auth/signingconversion functions become plain integer casts.16 → 2 files importing
cosmossdk.io/api/cosmos/tx/signing/v1beta1(remaining 2:
adapter.go+testutil/util.go— deferred to Phase 4, use pulsarModeInfo_Single)Phase 3 — Reflection gRPC stubs + msg/v1 extensions
runtime/services/reflectionpackage hand-writes thecosmos.reflection.v1.ReflectionServicegRPC stub without the pulsar dependency. 4 → 0 files importingcosmossdk.io/api/cosmos/reflection/v1.types/msgservice/extensions_v2.goadds*protoimpl.ExtensionInfoinstances (E_ServiceV2,E_SignerV2) compatible with the protov2 API. Used byconfigurator.go,validate.go,autocli.go,builder.go. 6 → 2 files importingcosmossdk.io/api/cosmos/msg/v1(remaining 2: inx/tx/signing— cycle-blocked, Phase 4).Rebase note
Rebased on main after #26456 (remove
SIGN_MODE_TEXTUAL) merged, which deletedx/tx/signing/textual/. This automatically removed 3 moresigningv1beta1and 2txv1beta1import sites.Deferred to Phase 4 (pulsar Tx type replacement)
x/auth/tx/adapter.go,x/tx/decode/decode.go,x/tx/signing/direct/direct.go,x/tx/signing/directaux/direct_aux.go— usetxv1beta1.SignDoc,txv1beta1.Tx,txv1beta1.SignDocDirectAuxfor protov2 marshaling viaprotoreflect. Replacing these requires substituting the gogoproto Tx types throughout the signing path.Issue: N/A