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

feat: Unify v2 & v3 types #501

Merged
merged 127 commits into from
Feb 8, 2024
Merged

feat: Unify v2 & v3 types #501

merged 127 commits into from
Feb 8, 2024

Conversation

pxrl
Copy link
Contributor

@pxrl pxrl commented Jan 19, 2024

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.

pxrl and others added 30 commits January 15, 2024 13:12
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.
test/SpokePoolClient.v3Events.ts Outdated Show resolved Hide resolved
@pxrl pxrl requested a review from nicholaspai February 7, 2024 13:36
Copy link
Contributor

@mrice32 mrice32 left a 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.

src/clients/SpokePoolClient.ts Outdated Show resolved Hide resolved
src/clients/SpokePoolClient.ts Outdated Show resolved Hide resolved
src/clients/SpokePoolClient.ts Outdated Show resolved Hide resolved
src/clients/SpokePoolClient.ts Outdated Show resolved Hide resolved
Copy link
Member

@nicholaspai nicholaspai left a 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

pxrl and others added 2 commits February 8, 2024 02:05
Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
Copy link
Contributor

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

LGTM!

src/clients/SpokePoolClient.ts Outdated Show resolved Hide resolved
@pxrl pxrl merged commit 9a2f0f4 into master Feb 8, 2024
3 checks passed
@pxrl pxrl deleted the pxrl/v3types branch February 8, 2024 04:20
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.

4 participants