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

docs(adr): ADR-045: BaseApp {Check,Deliver}Tx as Middlewares #9996

Merged
merged 14 commits into from
Sep 15, 2021
Merged

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Aug 24, 2021

Description

rendered

Closes: #9953


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)

@github-actions github-actions bot added the T: ADR An issue or PR relating to an architectural decision record label Aug 24, 2021
@amaury1093 amaury1093 changed the title ADR-045: BaseApp {Check,Deliver}Tx as Middlewares docs(ADR): ADR-045: BaseApp {Check,Deliver}Tx as Middlewares Aug 25, 2021
@amaury1093 amaury1093 changed the title docs(ADR): ADR-045: BaseApp {Check,Deliver}Tx as Middlewares docs(adr): ADR-045: BaseApp {Check,Deliver}Tx as Middlewares Aug 25, 2021
@amaury1093 amaury1093 marked this pull request as ready for review August 25, 2021 13:07
@orijbot
Copy link

orijbot commented Aug 25, 2021

Comment on lines +137 to +151
```
A.pre
B.pre
C.pre
H # The base tx.handler, for example `RunMsgsTxHandler`
C.post
B.post
A.post
```

We define a `ComposeMiddlewares` function for composing middlewares. It takes the base handler as first argument, and middlewares in the "outer to inner" order. For the above stack, the final `tx.Handler` is:

```go
txHandler := middleware.ComposeMiddlewares(H, A, B, C)
```
Copy link
Contributor Author

Choose a reason for hiding this comment

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

given the diagram, do you think ComposeMiddlewares(H, A, B, C) is clearer or ComposeMiddlewares(H, C, B, A)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think ComposeMiddlewares(H, C, B, A) is easier to point that it goes from the inner layer up to the outer one.

@amaury1093 amaury1093 requested a review from ethanfrey August 25, 2021 14:30
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.

nicely written, thank you!

@amaury1093
Copy link
Contributor Author

@aaronc since you're on the ADR reviewing committee, would you like to give the final approval before merge?

@aaronc
Copy link
Member

aaronc commented Sep 15, 2021

Good work @AmauryM 🎉

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Sep 15, 2021
@mergify mergify bot merged commit fcd6733 into master Sep 15, 2021
@mergify mergify bot deleted the am/adr-045 branch September 15, 2021 17:12
@amaury1093 amaury1093 mentioned this pull request Nov 25, 2021
4 tasks
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:x/auth T: ADR An issue or PR relating to an architectural decision record
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write ADR for the Check/DeliverTx middleware refactor
10 participants