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 market keeper against master #150

Merged
merged 14 commits into from
Sep 30, 2021
Merged

Refactor market keeper against master #150

merged 14 commits into from
Sep 30, 2021

Conversation

blewater
Copy link
Contributor

  • Closes #135 remove the returned sdk.Result from the Keeper API.
  • Sets the context's event manager to return events.
  • Added missing error descriptions.
  • Added add-market, cancelreplace order type bdd tests.
  • Added bdd test market order event validation.

@blewater blewater requested a review from haasted September 27, 2021 14:45
}
}

Expect(foundAccept).To(BeTrue(), "did not find the accept event")
Copy link
Collaborator

Choose a reason for hiding this comment

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

These checks appear to never be hit due to the return statements above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's an extra boolean condition && ...
The flow falls to the expect statements when it did not find the fill when it should be and affirm the accept was found and the opposite case accept was there but the fill...

networktest/emcli.go Outdated Show resolved Hide resolved
@@ -150,6 +152,8 @@ func (k *Keeper) NewOrderSingle(ctx sdk.Context, aggressiveOrder types.Order) (*
ctx, commitTrade := ctx.CacheContext()

defer func() {
retEvManager.EmitEvents(ctx.EventManager().Events())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this happen after the check to see whether the order should be killed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's the expire event for kill orders and IMHO the event manager should be operable for all code return paths for negative events if needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it always needs to happen, it can be placed outside the deferred function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

outside the defer would miss events when returning on errors

Copy link
Collaborator

Choose a reason for hiding this comment

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

The function is actually divided into two: Precondition checks, which may return errors, and "order accepted" which runs the rest of the function. After order accepted, there is no return statements until the end of the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved it before return.

@blewater blewater requested a review from haasted September 29, 2021 14:17
@blewater
Copy link
Contributor Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Sep 30, 2021

Command update: failure

Base branch update has failed
merge conflict between base and head
err-code: 19B3B

@mergify mergify bot merged commit feaf93a into master Sep 30, 2021
mergify bot pushed a commit that referenced this pull request Sep 30, 2021
* Rely on ctx's event manager

* 136 inflation (#141)

* Add upgrade handler for lilmermaid-16

* Externalize inflation types, keeper packages

* Group & sort imports

Co-authored-by: Martin Dyring-Andersen <[email protected]>
Co-authored-by: Mario Karagiorgas <[email protected]>

* Refactor: remove result from keeper methods

* Add description to the order errors

* Parse tx events and add market tx events checks

* Update AddMarketOrder to return events

* Add event check

* Add event validation for all market orders

* Simplify event validations

* Change error wording

* Move event manager before return, PR feedback

Co-authored-by: Henrik Aasted Sørensen <[email protected]>
Co-authored-by: Martin Dyring-Andersen <[email protected]>
(cherry picked from commit feaf93a)
mergify bot added a commit that referenced this pull request Sep 30, 2021
* Rely on ctx's event manager

* 136 inflation (#141)

* Add upgrade handler for lilmermaid-16

* Externalize inflation types, keeper packages

* Group & sort imports

Co-authored-by: Martin Dyring-Andersen <[email protected]>
Co-authored-by: Mario Karagiorgas <[email protected]>

* Refactor: remove result from keeper methods

* Add description to the order errors

* Parse tx events and add market tx events checks

* Update AddMarketOrder to return events

* Add event check

* Add event validation for all market orders

* Simplify event validations

* Change error wording

* Move event manager before return, PR feedback

Co-authored-by: Henrik Aasted Sørensen <[email protected]>
Co-authored-by: Martin Dyring-Andersen <[email protected]>
(cherry picked from commit feaf93a)

Co-authored-by: Mario Karagiorgas <[email protected]>
@blewater blewater deleted the 39-market-error branch September 30, 2021 12:03
@faddat faddat mentioned this pull request Oct 23, 2021
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.

Refactor market keeper
2 participants