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

feat: implement low-level dependency injection container #9666

Merged
merged 71 commits into from
Oct 4, 2021

Conversation

aaronc
Copy link
Member

@aaronc aaronc commented Jul 9, 2021

Description

closes #9775
needs #9658


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@orijbot
Copy link

orijbot commented Jul 23, 2021

Visit https://dashboard.github.orijtech.com?pr=9666&repo=cosmos%2Fcosmos-sdk to see benchmark details.

autoGroupTypes map[reflect.Type]bool
onePerScopeTypes map[reflect.Type]bool

// logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would extract the logging and the graphing from the options struct. I see the config used only to configure the container. As it is done when constructing with autoGroupTypes and onePerScope types.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where I would put them instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative would be adding a parameter or overload to Run just with debugging options separate from the container options. But that feels relatively involved. If you think it's useful to separate how about we align on an API and do that in a follow-up PR?

@github-actions github-actions bot added C:CLI C:Keys Keybase, KMS and HSMs labels Sep 23, 2021
@github-actions github-actions bot removed C:Keys Keybase, KMS and HSMs C:CLI labels Sep 23, 2021
@aaronc
Copy link
Member Author

aaronc commented Sep 23, 2021

@blushi @jgimeno I've addressed the review comments. Let me know if you can take a look and we can move forward. @jgimeno is okay to deal with debug options later or leave as is?

@aaronc aaronc requested review from blushi and jgimeno September 23, 2021 15:14
@aaronc
Copy link
Member Author

aaronc commented Sep 24, 2021

I've fixed the issues with auto-group and one-per-scope types in #10222. I'm making progress on #9862. Can we merge this now?

I think I might want to pull the logging stuff out of Option but let's do that separately.

Copy link
Contributor

@blushi blushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov
Copy link

codecov bot commented Sep 30, 2021

Codecov Report

Merging #9666 (9736a06) into master (d07e416) will decrease coverage by 0.08%.
The diff coverage is n/a.

❗ Current head 9736a06 differs from pull request most recent head 30b21ea. Consider uploading reports for the commit 30b21ea to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9666      +/-   ##
==========================================
- Coverage   63.73%   63.65%   -0.09%     
==========================================
  Files         572      573       +1     
  Lines       53966    53761     -205     
==========================================
- Hits        34397    34222     -175     
+ Misses      17612    17590      -22     
+ Partials     1957     1949       -8     
Impacted Files Coverage Δ
baseapp/state.go 0.00% <0.00%> (-50.00%) ⬇️
x/auth/middleware/index_events.go 39.28% <0.00%> (-35.72%) ⬇️
x/bank/types/key.go 82.35% <0.00%> (-17.65%) ⬇️
x/auth/middleware/run_msgs.go 58.18% <0.00%> (-12.09%) ⬇️
client/keys/list.go 67.85% <0.00%> (-10.72%) ⬇️
baseapp/grpcrouter.go 79.72% <0.00%> (-6.21%) ⬇️
x/auth/middleware/gas.go 64.70% <0.00%> (-5.89%) ⬇️
x/auth/middleware/recovery.go 58.82% <0.00%> (-5.89%) ⬇️
server/mock/app.go 78.75% <0.00%> (-4.98%) ⬇️
x/auth/tx/mode_handler.go 78.94% <0.00%> (-2.01%) ⬇️
... and 59 more

Copy link
Contributor

@fdymylja fdymylja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No strong opinion on https://github.com/cosmos/cosmos-sdk/pull/9666/files#r710071800. But I tend to agree to split logging/graphing functionality from the logic functionality, since overall what happens is not easy to follow I'd try to keep the functionality scope of components as small as possible.

@aaronc aaronc added the A:automerge Automatically merge PR once all prerequisites pass. label Oct 4, 2021
@mergify mergify bot merged commit fb78bbf into master Oct 4, 2021
@mergify mergify bot deleted the aaronc/container-impl branch October 4, 2021 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:depinject Issues and PR related to depinject
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Dependency Injection Container
6 participants