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

refactor!: Remove sdk.Router and refactor baseapp tests #13005

Merged
merged 41 commits into from
Aug 30, 2022

Conversation

facundomedica
Copy link
Member

@facundomedica facundomedica commented Aug 23, 2022

Description

Closes: #12802
Closes: #12803

Note to reviewers: I had to split some tests between baseapp and baseapp_test because of 1. cyclic deps, 2. needed access to unexported fields.


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)

@codecov
Copy link

codecov bot commented Aug 29, 2022

Codecov Report

Merging #13005 (a1f2db0) into main (4fe7797) will decrease coverage by 2.44%.
The diff coverage is 52.99%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13005      +/-   ##
==========================================
- Coverage   55.87%   53.43%   -2.45%     
==========================================
  Files         646      647       +1     
  Lines       54895    55083     +188     
==========================================
- Hits        30675    29434    -1241     
- Misses      21762    23307    +1545     
+ Partials     2458     2342     -116     
Impacted Files Coverage Δ
baseapp/abci.go 64.09% <0.00%> (-0.33%) ⬇️
baseapp/options.go 69.23% <ø> (+0.71%) ⬆️
client/context.go 55.37% <0.00%> (-0.91%) ⬇️
client/flags/flags.go 19.35% <0.00%> (-0.32%) ⬇️
client/rpc/status.go 66.66% <ø> (ø)
client/utils.go 34.92% <0.00%> (ø)
server/config/config.go 38.00% <0.00%> (-1.59%) ⬇️
server/mock/store.go 19.00% <0.00%> (-0.39%) ⬇️
server/rollback.go 0.00% <0.00%> (ø)
server/rosetta/client_online.go 1.35% <0.00%> (ø)
... and 133 more

@facundomedica facundomedica marked this pull request as ready for review August 30, 2022 18:02
@facundomedica facundomedica requested a review from a team as a code owner August 30, 2022 18:02
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

utACK, do we feel like base app is sufficiently tested with this?

@tac0turtle tac0turtle merged commit 797bd12 into main Aug 30, 2022
@tac0turtle tac0turtle deleted the facu/remove-router branch August 30, 2022 21:50
@facundomedica
Copy link
Member Author

utACK, do we feel like base app is sufficiently tested with this?

In terms of coverage, this PR increases it by 0.1%; so no difference. I basically took most tests and converted them, only leaving out what was testing the router specifically.
So, it is testing as much as it was before, no additions made.

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

Nice! 🎉

@@ -367,17 +364,6 @@ func (app *BaseApp) setIndexEvents(ie []string) {
}
}

// Router returns the legacy router of the BaseApp.
func (app *BaseApp) Router() sdk.Router {
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably should have added an API-breaking changelog for this baseapp removal

@@ -149,7 +147,6 @@ func NewBaseApp(
db: db,
cms: store.NewCommitMultiStore(db),
storeLoader: DefaultStoreLoader,
router: NewRouter(),
queryRouter: NewQueryRouter(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at this, the legacy query router can also be removed, since #12725. @facundomedica would you like to take care of this too?

Wryhder pushed a commit to Wryhder/cosmos-sdk that referenced this pull request Oct 26, 2022
* test

* progress-ish

* progress

* progress

* make mocks

* progress

* test

* progress

* progress

* progress

* progress

* progress

* progress

* fix mock tests

* progress

* pretty much done, might need some tidying up

* lint

* re-enable blockgas test

* remove router

* gofumpt

* remove more references of Router

* fix

* remove unused code

* remove unused code

Co-authored-by: Marko <marbar3778@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove sdk.Router rewrite baseapp tests
4 participants