-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: Unify v2 & v3 types #501
Conversation
For preparing v3 SpokePoolClient functionality in advance of bumping contracts-v2.
This PR just shuffles some existing types around to make room for the new v3 types. It also introduces some convenience functions that will be useful for discriminating between v2 and v3 types, as well as extracting data from them. No functional change intended.
This change makes some non-functional refactoring to the SpokePoolClient to make it easier to introduce the support for v3. Doing it now just reduces the size and complexity of the subsequent diff.
Also update existing naming to map 1:1 onto their underlying SpokePool functions.
Suggested by James. Co-authored-by: James Morris, MS <96435344+james-a-morris@users.noreply.github.com>
Upgrade the various RelayData-dependent functions to work with v3 types. This will importantly be used for slow fill requests in the pending v3 bump.
Introduced unintentionally in the previous commit, this prevents parallel test execution and suppresses all other tests from running.
It's not possible to determine the realizedLpFeePct until a corresponding deposit has been located, because the deposit contains the quoteTimestamp.
The type of RelayData is implied by the parent object. tsc is quite good at figuring this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments on the use of asserts for ts hinting.
I think that practice is okay (better than casting), but if we can fix it through explicit function types, I think that's preferable. If we force the types on the reduce function, for instance, typescript might show an error that reveals that there is a case we aren't covering in our type assumptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest round of commits looks good, ptal at my comments
Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This reverts commit 8d96c72.
This PR rolls out v3 types everywhere by unifying them under the Deposit, Fill, ... types that are handled throughout the SDK and relayer codebases. With this change, all consumers of these datatypes must have implemented specific handling to discriminate between v2 and v3 events. In many cases these objects are passed transparently though functions because they are not evaluating any of the fields which are different between the two. tsc is very helpful to identify which codepaths need to be upgraded. Much of that work has occurred in advance of this change.