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

Jupiter desktop integration for Solana swaps #14298

Merged
merged 1 commit into from
Aug 12, 2022
Merged

Conversation

onyb
Copy link
Member

@onyb onyb commented Jul 22, 2022

Resolves brave/brave-browser#19474
Resolves brave/brave-browser#24559

Security https://github.com/brave/security/issues/960

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Demo

Solana.Swap.mov

@onyb onyb requested a review from a team as a code owner July 22, 2022 16:00
@onyb onyb self-assigned this Jul 22, 2022
@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label Jul 22, 2022
@onyb onyb force-pushed the f/wallet/jupiter-desktop branch 2 times, most recently from d5776e3 to 33535bb Compare July 25, 2022 13:54
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Contributor

@Douglashdaniel Douglashdaniel left a comment

Choose a reason for hiding this comment

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

++ Front-end

@onyb
Copy link
Member Author

onyb commented Jul 25, 2022

Browser tests crashing - could be related to brave/brave-browser#24129.

components/brave_wallet/browser/eth_tx_manager_unittest.cc Outdated Show resolved Hide resolved
components/brave_wallet/browser/eth_tx_manager_unittest.cc Outdated Show resolved Hide resolved
components/brave_wallet/browser/eth_tx_manager_unittest.cc Outdated Show resolved Hide resolved
components/brave_wallet/browser/fil_tx_manager_unittest.cc Outdated Show resolved Hide resolved
components/brave_wallet/browser/fil_tx_manager_unittest.cc Outdated Show resolved Hide resolved
components/brave_wallet/browser/solana_tx_manager.cc Outdated Show resolved Hide resolved
components/brave_wallet/browser/solana_tx_manager.cc Outdated Show resolved Hide resolved
components/brave_wallet/browser/solana_tx_manager.cc Outdated Show resolved Hide resolved
components/brave_wallet/browser/solana_tx_manager.cc Outdated Show resolved Hide resolved
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@onyb onyb requested a review from yrliou July 27, 2022 19:12
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

// if 0x contracts are ever exploited, we still opted for this to give
// users a frictionless UX and save on gas fees.
//
// The transaction confirmation screen for ERC20 approve() shows a loud
Copy link
Member

Choose a reason for hiding this comment

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

do you have a screenshot of this? cc @kdenhartog

Copy link
Member

Choose a reason for hiding this comment

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

oh is it the screenshot in https://github.com/brave/security/issues/960 ? if so NVM

Copy link
Member

Choose a reason for hiding this comment

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

Will give this a look to understand the tradeoff here a bit more and let you know what I think. Thanks for tagging me

Copy link
Member Author

Choose a reason for hiding this comment

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

Screenshot 2022-08-04 at 20 42 12

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@onyb onyb requested a review from yrliou August 5, 2022 19:41
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Member

@yrliou yrliou left a comment

Choose a reason for hiding this comment

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

c++ backend LGTM, please create an issue for supporting partial_sign (existed signatures provided in the encoded transaction) for transactions coming from MakeTxDataFromBase64EncodedTransaction, and make sure Android build is green (might need to rebase to latest master to avoid new calls not being caught.).

@yrliou
Copy link
Member

yrliou commented Aug 9, 2022

One more thing, please make sure to have security team's approval before merging.

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@onyb
Copy link
Member Author

onyb commented Aug 11, 2022

@diracdeltas @yrliou Please review 84263d91e96250791b177a939efe6a78b634e69c which adds a new helper convert_all_numbers_to_string to the rust json lib. It recursively converts all JS numbers in the JSON to a string, so there's no requirement to provide an RFC6901 path unlike other helpers in the same module.

Consequently, we now have the following benefits:

  1. We no longer perform C++ JSON parsing in the conversion callback, which is handled entirely in Rust.
  2. Fields previously unreachable by the Rust json lib for conversion (lpFee->amount and platformFee->amount) are parsed the same way as any other field.

@onyb onyb requested a review from supermassive August 11, 2022 02:52
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@yrliou yrliou requested review from rillian and antonok-edm and removed request for supermassive August 11, 2022 06:45
@yrliou
Copy link
Member

yrliou commented Aug 11, 2022

Add @rillian and @antonok-edm for either of them to review the rust impl in 84263d9.

components/json/rs/src/lib.rs Outdated Show resolved Hide resolved
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@onyb onyb merged commit b6a4d15 into master Aug 12, 2022
@onyb onyb deleted the f/wallet/jupiter-desktop branch August 12, 2022 05:35
@github-actions github-actions bot added this to the 1.44.x - Nightly milestone Aug 12, 2022
Value::Number(n) if n.is_u64() || n.is_i64() || n.is_f64() => {
*json = Value::String(n.to_string());
}
Value::Array(a) => a.iter_mut().for_each(convert_recursively),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you doing this recursively? This is very inefficient.
Also why are we applying this to everything instead of just applying it to the specific paths that we know need to be converted? This seems potentially dangerous to me and I think we should be much more strict about how we do conversions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement function in rust json lib to convert all u64 to strings Implement swaps in Solana
8 participants