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

constructors to create wasm contract call json payloads #4094

Conversation

Reecepbcups
Copy link
Member

@Reecepbcups Reecepbcups commented Jul 15, 2023

Description

Moves verifyMembership and verifyNonMembership types into their respective constructor functions for cleaner (1q line) payload generation.

closes: #4044

Commit Message / Changelog Entry

type: commit message

see the guidelines for commit messages. (view raw markdown for examples)


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

@crodriguezvega
Copy link
Contributor

Thank you for picking up a bunch of the 08-wasm issues, @Reecepbcups. :) This one in particular will require some changes, since we received a recommendation by Ethan Frey to organise the payload types a bit differently. I will open an issue and post it here when it's ready.

@Reecepbcups
Copy link
Member Author

np, sounds good

@damiannolan
Copy link
Member

damiannolan commented Jul 16, 2023

These structs will be replaced with two higher level structures for Sudo and Query contract calls with each containing a pointer to a struct to represent each action, note the omit_empty is required for json serialization. These structures play well with having the msg enums defined in the rust code for match expressions etc, naming tbc.

// encapsulates read-only contract calls
type QueryPayload struct {
  MsgStatus *StatusPayload `json:"msg_status,omitempty"`
  MsgVerifyMembership *VerifyMembershipPayload`json:"msg_verify_membership,omitempty"`
  // ..etc
}

// anything which writes to store
type SudoPayload struct {
  MsgInitialize *InitializePayload `json:"msg_initialize,omitempty"`
  MsgUpdateState *UpdateStatePayload `json:"msg_update_state,omitempty"`
  // ..etc
}

@Reecepbcups Reecepbcups marked this pull request as draft July 17, 2023 21:57
@crodriguezvega
Copy link
Contributor

Hi @Reecepbcups, this PR implements the changes mentioned by @damiannolan above. Take a look and let us know if you would like to continue the work of your PR. If you're busy, no problem, we can take over :) Also, it might be better to use the branch of #4133 to implement the changes on top of it.

@Reecepbcups
Copy link
Member Author

Reecepbcups commented Jul 24, 2023

@crodriguezvega Hey sorry for the late reply here. I will be out of town the next 7 - 10ish days still so I will not be able to take this on.

I will get to more cleanup PRs once I get back if this has not been handled by then. (+ older issues I find)

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

Successfully merging this pull request may close these issues.

3 participants