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

fix(cowSwapper): don't convert orderDigest to Uint8Array / hex #5382

Merged
merged 5 commits into from
Oct 3, 2023

Conversation

gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Oct 2, 2023

Description

Web counterpart of shapeshift/hdwallet#635 - open me after it is published

tl;dr is we're currently doing a triple conversion of the orderDigest which is useless, as it comes as an hex string already.
While this is theoretically only useless back and forth conversions which wouldn't break the flow, unfortunately, we're doing one too much here, meaning this isn't only some benign perf. bottleneck, but an actual product bug.

The conversion is made:

  • From an hex string to an Uint8Array in executeEvmMessage (see this PR's diff)
  • Then in hdwallet's ethSignMessage. e.g WCV2 implementation from a Uint8Array to a Uint8Array (?), then an hex string out of that

shapeshift/hdwallet#635 lays the groundwork for not converting things, but web is the missing bit. This PR fixes things here, by making sure we pass an hexlified string all around.

Pull Request Type

  • 🐛 Bug fix (Non-breaking Change: Fixes an issue)
  • 🛠️ Chore (Non-breaking Change: Doc updates, pkg upgrades, typos, etc..)
  • 💅 New Feature (Breaking/Non-breaking Change)

Issue (if applicable)

closes N/A

Risk

Risk of CoW swaps / ETH messages signing all around. In effect, this means Wherever may be broken across all wallets, and CoW swaps may be broken in other wallets - test accordingly

Testing

  • CoW swaps are working for all wallets
  • Wherever signing is working for all wallets

Engineering

  • ☝🏽

Operations

  • ☝🏽

Screenshots (if applicable)

image

https://explorer.cow.fi/gc/orders/0xa476f5b1e4508ad48ad988628a1a68243c08d4a0b9f8a5fe24e68157f86ad1855daf465a9ccf64deb146eeae9e7bd40d6761c986651a9520?tab=overview

@gomesalexandre gomesalexandre requested a review from a team as a code owner October 2, 2023 09:49
@gomesalexandre gomesalexandre marked this pull request as draft October 2, 2023 09:50
package.json Outdated Show resolved Hide resolved
@0xApotheosis
Copy link
Member

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@0xApotheosis 0xApotheosis marked this pull request as ready for review October 3, 2023 00:52
@0xApotheosis 0xApotheosis merged commit 77408ef into develop Oct 3, 2023
@0xApotheosis 0xApotheosis deleted the fix_cow_signing branch October 3, 2023 00:52
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.

2 participants