Skip to content
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

getOneOfs() oneofs cardinality not known! #643

Open
Nankys opened this issue Aug 10, 2024 · 3 comments
Open

getOneOfs() oneofs cardinality not known! #643

Nankys opened this issue Aug 10, 2024 · 3 comments

Comments

@Nankys
Copy link

Nankys commented Aug 10, 2024

Error: getOneOfs() oneofs cardinality not known!
at getOneOfs (/root/gencode/node_modules/.pnpm/@cosmology[email protected]/node_modules/@cosmology/ast/main/encoding/proto/types.js:162:15)
at createProtoType (/root/gencode/node_modules/.pnpm/@cosmology[email protected]/node_modules/@cosmology/ast/main/encoding/proto/interface/proto.js:59:42)
at buildBaseTypeScriptInterface (/root/gencode/node_modules/.pnpm/@cosmology[email protected]/node_modules/@cosmology/telescope/main/build.js:41:49)
at /root/gencode/node_modules/.pnpm/@cosmology[email protected]/node_modules/@cosmology/telescope/main/build.js:118:58
at Array.forEach ()
at TelescopeParseContext.buildBase (/root/gencode/node_modules/.pnpm/@cosmology[email protected]/node_modules/@cosmology/telescope/main/build.js:115:20)
at /root/gencode/node_modules/.pnpm/@cosmology[email protected]/node_modules/@cosmology/telescope/main/generators/create-types.js:46:17
at Array.map ()
at plugin (/root/gencode/node_modules/.pnpm/@cosmology[email protected]/node_modules/@cosmology/telescope/main/generators/create-types.js:43:35)
at /root/gencode/node_modules/.pnpm/@cosmology[email protected]/node_modules/@cosmology/telescope/main/builder.js:106:39

https://github.com/sunriselayer/sunrise/tree/main/proto/sunrise
https://github.com/sunriselayer/sunrise/blob/effea572e0b2661fca71a8bb88b8af530681ae57/proto/sunrise/swap/route.proto#L40
https://github.com/sunriselayer/sunrise/blob/effea572e0b2661fca71a8bb88b8af530681ae57/proto/sunrise/swap/metadata.proto#L51
https://github.com/sunriselayer/sunrise/blob/effea572e0b2661fca71a8bb88b8af530681ae57/proto/sunrise/swap/in_flight_packet.proto#L39
https://github.com/sunriselayer/sunrise/blob/effea572e0b2661fca71a8bb88b8af530681ae57/proto/sunrise/swap/in_flight_packet.proto#L43

@Nankys
Copy link
Author

Nankys commented Aug 18, 2024

export const getOneOfs = (type: ProtoType) => {
"Is there something wrong with this code?" “:” if (keys.length !== 1) throw new Error('getOneOfs() oneofs cardinality not known!');“@

@Zetazzz
Copy link
Collaborator

Zetazzz commented Aug 19, 2024

Hi, thanks for the feedback!

I think we can improve the error msg to make it more clear.

About this issue, I believe there maybe a message which has multiple oneofs like:

message TestRequest {

uint32 test_num = 1;

oneof test_oneof {
string id = 2;
string name = 3;
}
oneof test_oneof1 {
string id = 4;
string name = 5;
}
}

If there's a place like this, they have to combine into one.

@Zetazzz
Copy link
Collaborator

Zetazzz commented Aug 19, 2024

message IncomingInFlightPacket {
PacketIndex index = 1 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
bytes data = 2;
string src_port_id = 3;
string src_channel_id = 4;
string timeout_height = 5;
uint64 timeout_timestamp = 6;
bytes ack = 7;
RouteResult result = 8 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
string interface_fee = 9 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
oneof change {
PacketIndex outgoing_index_change = 10;
bytes ack_change = 11;
}
oneof forward {
PacketIndex outgoing_index_forward = 12;
bytes ack_forward = 13;
}
}

Here's the place went wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants