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

Separate fuzzer setup parameters from operations #2897

Merged
merged 1 commit into from
Feb 12, 2021

Conversation

rokopt
Copy link
Contributor

@rokopt rokopt commented Jan 29, 2021

Separate fuzzer setup parameters from operations

Part of #1376

Could be the beginning of a foundation for #2891 , #2892 , #2894

Factor out the specifics of which offers to create into a
single structure, which can be examined at a glance and
changed in isolation, from the operations which establish
that order book structure during fuzzer setup.

We plan to set up the order book to be more varied and less symmetrical than it currently is, but I think that we should separate working out how to factor out the parameters to make that kind of change simpler to perform and understand from actually making those changes. So in this commit, I'm not changing the initial order book, only how the setup is specified (this commit makes it declarative, and constexpr).

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v5.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

Copy link
Contributor

@MonsieurNicolas MonsieurNicolas left a comment

Choose a reason for hiding this comment

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

looks to be a step in the right direction

// and an account with a bid and a sell. It also gives us an initial
// order book that is in a legal state.
std::array<OfferParameters, 24> constexpr orderBookParameters{
{OfferParameters{AssetID(), AssetID(1), 13, 3, 2, 10}, // asset pair 0
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 we should try to make this section look as much as possible like the comment above (and that comment should be removed as it's wrong anyways):

  • use an empty line between order book pairs
  • price should be the last argument, and price should be sorted so that we can clearly see how the order book is structured (note that because price is in terms of sell/bid, the sort order flips when switching buy and sell)
  • I think you can get rid of the OfferParameters? (or maybe this is C++ 17)

Copy link
Contributor

Choose a reason for hiding this comment

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

Each section we should have some comment that explains which property we're trying to achieve.

To do this, we may have to do the same for accounts, that right now are setup pretty much all the same (instead, we probably want to mix things up a bit in terms of limits on balance entries and assets trusted).

Note: as we're trying to match the coverage from master, we may need less accounts and offers variations than what we're doing now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and that comment should be removed as it's wrong anyways

I left the part that documents the initial state of the order book, but removed the stuff about it being a "good mixture".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

use an empty line between order book pairs

Done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

price should be the last argument, and price should be sorted so that we can clearly see how the order book is structured (note that because price is in terms of sell/bid, the sort order flips when switching buy and sell)

I've made Price into the last argument (and otherwise brought the argument order into line with the comment). I think it was already in best-offer order? I might be misunderstanding that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you can get rid of the OfferParameters? (or maybe this is C++ 17)

Oh yes, you're right. I thought it was C++17, but clang at least is allowing me to do it with std=c++14.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each section we should have some comment that explains which property we're trying to achieve.

To do this, we may have to do the same for accounts, that right now are setup pretty much all the same (instead, we probably want to mix things up a bit in terms of limits on balance entries and assets trusted).

Note: as we're trying to match the coverage from master, we may need less accounts and offers variations than what we're doing now.

Agreed on all points -- I wanted to start with just the order book so that we could get consensus on how the parameter-refactoring should look, and then once that was merged, I'd do the same for accounts, and for the other structures that I'm adding to setup. I also definitely plan to change the setup parameters themselves, but I wanted to separate the mechanism changes from the policy changes.

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 this is good now. I'm going to merge it tomorrow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is good now. I'm going to merge it tomorrow

Thanks. I've rebased onto master.

@rokopt rokopt force-pushed the fuzzer-setup-refactor-parameters branch 2 times, most recently from df9cd7c to d56c5f9 Compare February 3, 2021 20:25
@rokopt
Copy link
Contributor Author

rokopt commented Feb 3, 2021

I think I've handled all code-review comments; how does the change look now?

@MonsieurNicolas MonsieurNicolas added this to In progress in v15.3.0 Feb 10, 2021
Factor out the specifics of which offers to create into a
single structure, which can be examined at a glance and
changed in isolation, from the operations which establish
that order book structure during fuzzer setup.
@rokopt rokopt force-pushed the fuzzer-setup-refactor-parameters branch from d56c5f9 to 9ef9dbc Compare February 10, 2021 19:07
@MonsieurNicolas
Copy link
Contributor

r+ 9ef9dbc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants