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

Add common getter and setter to message types #3604

Closed
3 tasks
mmsqe opened this issue May 17, 2023 · 5 comments
Closed
3 tasks

Add common getter and setter to message types #3604

mmsqe opened this issue May 17, 2023 · 5 comments
Labels
needs information Issues that need more information from the author

Comments

@mmsqe
Copy link
Contributor

mmsqe commented May 17, 2023

Summary

support generic unmarshal and exec msg server methods

Problem Definition

Currently it's hard to handle different message types with a generic approach. Since common methods to access attributes like Signer, ClientState, ConsensusState are missing, we can only manipulate with that message concrete type.

Proposal

Add common exported methods to all message types to get attributes including Signer, ClientState, ConsensusState and Misbehaviour, also methods to set those except Signer. With these methods, it allows us to define common Interface and thus generics when handling these message types.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@colin-axner
Copy link
Contributor

Thanks for opening up the issue @mmsqe. A couple initial questions that come to mind:

  1. In what context are you unmarshaling messages? (via smart contracts, or off chain, or sdk module?)
  2. I see the SDK will be adding proto annotations to indicate the Signer of a msg, would this be sufficient for getting the signer. Why can't GetSigners be used currently?
  3. What generic handling are you trying to perform? Why do you need access to the client or consensus state in a generic manner?

@mmsqe
Copy link
Contributor Author

mmsqe commented May 18, 2023

Thanks for opening up the issue @mmsqe. A couple initial questions that come to mind:

@colin-axner Follow you questions:

  1. sdk module
  2. I change to use sdk's GetSigners with single signer, which is the current case.
  3. generic handling is allow msg server call msg directly in precompile, which accept the protobuf encoded message as input, pass that directly to native handlers.

@damiannolan
Copy link
Contributor

Hey @mmsqe, I'm having trouble understanding the precompile ethermint/evm code snippet you've provided and what problem it is trying to solve. Is there an issue in ethermint which states the problem?

From what I can tell the code is relying on a large switch statement which checks some byte prefix for specific cases(?) - this doesn't seem to lend itself well to a generic msg handling pattern.

@crodriguezvega
Copy link
Contributor

@mmsqe Is this issue still relevant? If yes, can you provide us more information so that we can understand better the problem? (see Damian's question above)

@crodriguezvega crodriguezvega added the needs information Issues that need more information from the author label Mar 19, 2024
@mmsqe
Copy link
Contributor Author

mmsqe commented Mar 20, 2024

@damiannolan @crodriguezvega sorry for the late reply, we come up with a generic way to handle, we could close this now.

@mmsqe mmsqe closed this as completed Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs information Issues that need more information from the author
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants