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

Add a script that checks consistency between different fetching methods #675

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fleupold
Copy link
Contributor

Given the consistency errors we had with the viewers' orderbook functions (e.g #672) this PR is creating a consistency checking script, that compares the results of the BatchExchangeViewer to the traditional (client-filtered) way of fetching orders.

The goal it to run this script against mainnet/rinkeby and get alerted when the responsed don't match.

In order to get consistent results, we need to pin the query on a specify block number (e.g. the last block of when the batch was still open to receive orders for getOpenOrderbookPaginated and the first block of when the batch was ready to be solved getFinalizedOrderbookPaginated + legacy approach).

Note, that there is still the small chance of inconsistencies if a solution was submitted in the very first block of the batch being open for solutions (this is very unlikely to happen).

Test Plan

Deploy this script in staging and let it run for the next few hours/days.

@fleupold fleupold requested a review from a team April 19, 2020 14:48
Copy link
Contributor

@nlordell nlordell left a comment

Choose a reason for hiding this comment

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

Awesome!

@@ -0,0 +1,80 @@
const BatchExchange = artifacts.require("BatchExchange")
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason you chose to write this in JS? I'm assuming its related to missing truffle typings?

@@ -0,0 +1,2 @@
node_modules
build
Copy link
Contributor

Choose a reason for hiding this comment

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

ubernit: missing newline at end of file.

@bh2smith
Copy link
Contributor

Note, that there is still the small chance of inconsistencies if a solution was submitted in the very first block of the batch being open for solutions (this is very unlikely to happen).

I still don't understand why not query from the block immediately before the first one published since the batch closed. This would have all the information and should have no problems of this type.

Copy link
Contributor

@bh2smith bh2smith left a comment

Choose a reason for hiding this comment

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

This looks very nice.

@nlordell
Copy link
Contributor

I still don't understand why not query from the block immediately before the first one published since the batch closed.

I believe that has some issues with how the contract calculates balances. Don't quote me on this, as I'm not sure, but I think that the batch ID is used to determine if a pending flux should be credited to the balance or not.

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

Successfully merging this pull request may close these issues.

3 participants