telescope icon indicating copy to clipboard operation
telescope copied to clipboard

DecCoin from cosmos sdk is not properly encoded/decoded

Open stalniy opened this issue 7 months ago • 1 comments

Problem

DecCoin from cosmos sdk is not properly encoded/decoded is marked as Dec via option (gogoproto.customtype) = "Dec" but telescope doesn't properly processes it because cosmos proto specifies (gogoproto.customtype) = "Dec" for DecCoin['amount'] field and go_package is specified in the same file at the top. BUT telescope generator expects this option to be fully qualified (i.e., expects (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec").

It means that protofiles parser doesn't take into account option go_package at file level and produces incorrect AST for DecCoin['amount'] field

Additional context

I did some debugging of source code and found out that indeed parser receives Dec (not github.com/cosmos/cosmos-sdk/types.Dec) in args.field.options?.['(gogoproto.customtype)'] that's why encode/decode functions are not properly generated for DecCoin['amount'] property

stalniy avatar Feb 27 '25 15:02 stalniy