-
Notifications
You must be signed in to change notification settings - Fork 44
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
(Nested) Any
from/toAmino not symmetrical
#660
Comments
I also tried using the ...
const submitMsg: MsgSubmitProposalEncoded = {
groupPolicyAddress: POA_GROUP_ADDRESS,
title,
summary,
proposers,
exec: Exec.EXEC_UNSPECIFIED,
messages: messages.map((msg) => Any.toProtoMsg(msg)),
metadata: "",
}
const msg = GroupMessageComposer.fromPartial.submitProposal(submitMsg);
const result = await client.signAndBroadcast(signer, [msg], fee);
... where
without luck. I'm getting the following error
|
The issue is a Telescope issue but stems from how CosmJS does things in // signAmino()
...
const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
...
const signedTxBody = {
messages: signed.msgs.map((msg) => this.aminoTypes.fromAmino(msg)),
memo: signed.memo,
timeoutHeight: timeoutHeight,
};
... The In message.messages = object.messages?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; where At this point, the concrete type of the message is lost because This is wrong. WorkaroundI modified CosmJS so as not to call const signedTxBody = {
messages,
memo: signed.memo,
timeoutHeight: timeoutHeight,
}; and things started working properly. |
fromAmino
discard message typeAny
from/toAmino not symmetrical
I was debugging some FE code last Friday and discovered that
According to the ProtoJSON Format,
I believe the code generated by Telescope only covers the 1st case. |
Problem
The call to
fromAmino
removes the nested message type indicator in a group proposal, causing an issue when multiple message types contain the same fields.Context
Telescope configuration
The POA module contains MsgRemovePending and MsgRemoveValidator differing only by message name, i.e., the message fields are the same in both messages.
The remove pending validator test creates a
Group Proposal
containing aRemove Pending Validator
message, submits the proposal, vote on it and execute the proposal.Encoding and signing the message using AMINO works fine
The nested message is of the right type. However, the
signedTxBodyEncodedObject
created in thesignAmino
method and broadcasted to the server isNotice that the nested
message
field has no type indicator. This field is created by the call tofromAmino
The message decoded by the server is of type
poa/RemoveValidator
instead ofpoa/RemovePending
causing the signature check to fail. I suspect the lack of type indication in the nested message causes the issue. One is unable to match the type only from the instance.Everything works fine when using the
DIRECT
signer. Everything also works fine using the AMINO signer from themanifestd
CLI.Running the test
The text was updated successfully, but these errors were encountered: