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

Refactore simapp.MakeEncodingConfig #7642

Closed
4 tasks
robert-zaremba opened this issue Oct 23, 2020 · 12 comments · Fixed by #12747
Closed
4 tasks

Refactore simapp.MakeEncodingConfig #7642

robert-zaremba opened this issue Oct 23, 2020 · 12 comments · Fixed by #12747
Assignees
Labels
C:Encoding S:proposed T: Tests Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.

Comments

@robert-zaremba
Copy link
Collaborator

Summary

We have two functions to create a global encoding config:

  • simapp.MakeEncodingConfig - it will use the latter one and register interfaces for a codec in all modules
  • simappparams.MakeEncodingConfig - it will only create an internal codec based on build flags (amino or protobuf).

Problem Definition

simapp.MakeEncodingConfig souldn't be exposed - it's an implementation detail for creating an app. App codecs should be used. Using MakeEncodingConfig is source of some problems we had recently with codecs and tests.

Proposal

don't expose simapp.MakeEncodingConfig


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@robert-zaremba robert-zaremba added Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. C:Encoding backport/0.40.x (Stargate) labels Oct 23, 2020
@robert-zaremba robert-zaremba added this to the v0.40 [Stargate] milestone Oct 23, 2020
@robert-zaremba robert-zaremba self-assigned this Oct 23, 2020
@colin-axner
Copy link
Contributor

colin-axner commented Oct 23, 2020

cc: @jackzampolin the relayer will need to update this, I saw usage of MakeEncodingConfig in chains.go

Edit: nvm I see the WIP pr that will change this to use the simappparams

@aaronc
Copy link
Member

aaronc commented Oct 23, 2020

MakeEncodingConfig is part of simapp used for tests. It would have been a huge refactoring of lots of tests to not do something like this. If apps are depending on simapp that's a problem in and of itself. It's just for testing.

We can do something better but I don't consider this a necessary stargate backport.

Also, I imagine the complexity of this will be large. We have higher priority backports to deal with.

@robert-zaremba
Copy link
Collaborator Author

We can do something better but I don't consider this a necessary stargate backport.

I wanted to rename it, to make it clear that users should not use it and rather use the app directly. But there was objection.

The easiest way to do this task is:

  • make this function private
  • use app codecs instead.

@clevinson
Copy link
Contributor

I agree that this also seems like quite a large refactor. The most important things for v0.40.0 (Stargate backports) are:

  • UX fixes & bug fixes of issues in the current release candidate
  • documentation & testing of existing features
  • high priority features that we missed that are state machine breaking (and therefore would require a chain upgrade)

This issue is laregely about devUX, which is important, but not critical IMO for a backport. Let's please hold off on work for it for now until we have Stargate out the door and published.

@aaronc
Copy link
Member

aaronc commented Oct 23, 2020

  • use app codecs instead.

There's a reason why that wasn't done initially. Basically because it wasn't how tests were structured before and it will be a lot of work. To me it's clearly out of scope for a backport. Users shouldn't be depending on anything in simapp and if they do that's sort of at their own risk.

@robert-zaremba
Copy link
Collaborator Author

@aaronc - can we at least change a method name? Originally I was proposing to add a Test suffix, but there was lack of consensus. We should somehow make it clear for users to not repeat our mistakes and not use this function in tests.
discord [chat](https://discordapp.com/channels/684494798358315010/758982012861677618/768906239198363668 reference.

@robert-zaremba
Copy link
Collaborator Author

Related issue: #7310

@robert-zaremba
Copy link
Collaborator Author

another one:
Limit the creation of uncessary EncodingConfigs #7631

@aaronc
Copy link
Member

aaronc commented Oct 23, 2020

@aaronc - can we at least change a method name?

How about MakeTestEncodingConfig?

@aaronc
Copy link
Member

aaronc commented Oct 23, 2020

EncodingConfig itself should never be used outside SDK tests. Maybe it should be called TestEncodingConfig itself.

@robert-zaremba
Copy link
Collaborator Author

How about MakeTestEncodingConfig?

I'm OK with that. In my previous PR (Any for validator key) @amaurymartiny and @blushi didn't like it.

@robert-zaremba
Copy link
Collaborator Author

Here: #7597 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Encoding S:proposed T: Tests Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants