Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Removes transition btc->bat code #13039

Merged
merged 2 commits into from
Feb 21, 2018
Merged

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Feb 6, 2018

Resolves #12712

Do not squash commits

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed. (Ask a Brave employee to help if you cannot access this document.)

Test Plan:

  1. old wallet
  • create wallet on version 0.18 so that you have BTC wallet
  • copy that wallet into this branch
  • run browser
  • check payments page (you should see new wallet created for you)
  • check profile folder to see if there is file ledger-state-btc.json
  1. new wallet
  • create wallet on 0.20
  • add some BAT into it
  • copy that wallet into this branch
  • run browser
  • make sure that no money was lost and that old wallet is still there

Reviewer Checklist:

  • Request a security/privacy review as needed if one was not already requested.

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@NejcZdovc NejcZdovc added this to the 0.20.x Hotfix 3 (Ledger improvments) milestone Feb 6, 2018
@NejcZdovc NejcZdovc self-assigned this Feb 6, 2018
@codecov-io
Copy link

codecov-io commented Feb 6, 2018

Codecov Report

Merging #13039 into master will decrease coverage by 0.32%.
The diff coverage is 26.66%.

@@            Coverage Diff             @@
##           master   #13039      +/-   ##
==========================================
- Coverage   56.26%   55.94%   -0.33%     
==========================================
  Files         282      281       -1     
  Lines       28027    27805     -222     
  Branches     4585     4552      -33     
==========================================
- Hits        15770    15556     -214     
+ Misses      12257    12249       -8
Flag Coverage Δ
#unittest 55.94% <26.66%> (-0.33%) ⬇️
Impacted Files Coverage Δ
app/browser/reducers/ledgerReducer.js 44.16% <ø> (-2.31%) ⬇️
js/actions/appActions.js 18.8% <ø> (-1.31%) ⬇️
app/renderer/components/styles/animations.js 100% <ø> (ø) ⬆️
app/renderer/components/preferences/paymentsTab.js 71.22% <ø> (-0.61%) ⬇️
js/constants/appConstants.js 100% <ø> (ø) ⬆️
app/sessionStore.js 88.06% <ø> (ø) ⬆️
...r/components/preferences/payment/enabledContent.js 75.35% <ø> (+0.01%) ⬆️
app/browser/api/ledgerNotifications.js 70.95% <ø> (-4.38%) ⬇️
app/locale.js 35.77% <ø> (ø) ⬆️
app/browser/api/ledger.js 58.79% <26.66%> (-1.51%) ⬇️
... and 8 more

@alexwykoff alexwykoff modified the milestones: 0.20.x Hotfix 3 (Ledger improvments), 0.21.x (Beta Channel) Feb 6, 2018
@NejcZdovc NejcZdovc requested review from bsclifton, evq, srirambv and LaurenWags and removed request for bsclifton and evq February 7, 2018 09:15
@NejcZdovc NejcZdovc force-pushed the feature/#12712-btc branch 3 times, most recently from 06ec55e to 1e04fd3 Compare February 19, 2018 05:30
@bsclifton
Copy link
Member

@NejcZdovc can we get a rebase on this one?

@NejcZdovc
Copy link
Contributor Author

@bsclifton rebased

@@ -2390,147 +2388,6 @@ const deleteSynopsis = () => {
synopsis.publishers = {}
}

// fix for incorrectly persisted state (see #11585)
const yoDawg = (stateState) => {
Copy link
Member

Choose a reason for hiding this comment

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

RIP the yoDawg bug fix 💯
cc: @evq

parsedData.properties.wallet &&
parsedData.properties.wallet.keychains

if (isBTC) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add verbose logging here- something like:
Bitcoin wallet detected; backing up to "ledger-state-btc.json" and creating new BAT wallet

@bsclifton
Copy link
Member

  • I looked over the code changes closely and they look great 👍
  • Test plan 1 worked great 👍
  • Test plan 2 is failing for me... I copied my production profile (both session-store-1 and ledger-state.json) and the following error is logged to console:
An uncaught exception occurred in the main process Uncaught Exception:
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
    at fromObject (buffer.js:274:9)
    at Function.Buffer.from (buffer.js:106:10)
    at Object.Client.getWalletPassphrase (/Users/clifton/Documents/browser-laptop/node_modules/bat-client/index.js:508:46)
    at getStateInfo (/Users/clifton/Documents/browser-laptop/app/browser/api/ledger.js:1524:43)
    at Object.onInitRead (/Users/clifton/Documents/browser-laptop/app/browser/api/ledger.js:2079:11)
    at ledgerReducer (/Users/clifton/Documents/browser-laptop/app/browser/reducers/ledgerReducer.js:302:27)
    at handleAppAction (/Users/clifton/Documents/browser-laptop/js/stores/appStore.js:230:16)
    at callbacks.forEach (/Users/clifton/Documents/browser-laptop/js/dispatcher/appDispatcher.js:107:7)
    at Array.forEach (<anonymous>)
    at AppDispatcher.dispatchToOwnRegisteredCallbacks (/Users/clifton/Documents/browser-laptop/js/dispatcher/appDispatcher.js:106:20)
    at AppDispatcher.dispatchInternal (/Users/clifton/Documents/browser-laptop/js/dispatcher/appDispatcher.js:132:10)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

@NejcZdovc
Copy link
Contributor Author

@bsclifton second test plan error is not related to this PR. Will be fixed with this one #13201

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Rebased after merging #13201 and verified it's working as expected 😄 👍

@bsclifton
Copy link
Member

@evq @LaurenWags @srirambv would you all care to give this one a review too? 😄

@LaurenWags
Copy link
Member

LaurenWags commented Feb 20, 2018

Tests Ran:

  1. Old Profile and (production) wallet from 0.18.36 (last released version with BTC wallets) Payments were ON and my ledger table had data - PASSED
    a. took a copy of profile from 0.18.36 where Payments were ON and ledger table had data (wallet had 0 BTC), renamed the profile copy to be brave-development
    b. built and ran PR
    c. Verified did not see transition overlay (bouncing balls), verified ledger data was retained, verified wallet was created (addresses and QR codes visible in 'Add Funds'), verified presence of ledger-state-btc.json file in brave-development profile folder.

  2. Old Profile and (production) wallet from 0.18.36 (last released version with BTC wallets) Payments were OFF and my ledger table had data - PASSED
    a. took a copy of profile from 0.18.36 where Payments were OFF and ledger table had data (wallet had 0 BTC), renamed the profile copy to be brave-development
    b. built and ran PR
    c. Enabled Payments from Preferences
    d. Verified did not see transition overlay (bouncing balls), verified ledger data was retained, verified wallet was created (addresses and QR codes visible in 'Add Funds'), verified presence of ledger-state-btc.json file in brave-development profile folder.

  3. Profile and (staging) wallet from 0.20.42. Payments were ON and my ledger table had data - PASSED
    a. took a copy of a profile from 0.20.42 where Payments were ON and ledger table had data (staging wallet had 10 BAT), renamed the profile copy to be brave-development
    b. built and ran PR
    c. Verified did not see transition overlay (bouncing balls), verified ledger data was retained, verified wallet was retained (addresses and QR codes visible in 'Add Funds', no BAT lost), verified there is not a ledger-state-btc.json file in brave-development profile folder.

  4. Profile and (staging) wallet from 0.20.42. Payments were OFF and my ledger table had data - PASSED
    a. took a copy of a profile from 0.20.42 where Payments were OFF and ledger table had data (staging wallet had 10 BAT), renamed the profile copy to be brave-development
    b. built and ran PR
    c. Enabled Payments from Preferences
    d. Verified did not see transition overlay (bouncing balls), verified ledger data was retained, verified wallet was retained (addresses and QR codes visible in 'Add Funds', no BAT lost), verified there is not a ledger-state-btc.json file in brave-development profile folder.

Copy link
Member

@LaurenWags LaurenWags left a comment

Choose a reason for hiding this comment

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

Tests ran are detailed in #13039 (comment) and all were as expected/passed.

@bsclifton bsclifton merged commit aedf064 into brave:master Feb 21, 2018
@bsclifton
Copy link
Member

master aedf064

@NejcZdovc will need your help cherry-picking to 0.22.x and 0.21.x 😄

NejcZdovc pushed a commit that referenced this pull request Feb 21, 2018
NejcZdovc pushed a commit that referenced this pull request Feb 21, 2018
@NejcZdovc
Copy link
Contributor Author

0.22 b68673f
0.21 ff3e0ec

@NejcZdovc NejcZdovc modified the milestones: 0.21.x (Beta Channel), 0.21.x (Twitch) Feb 24, 2018
NejcZdovc pushed a commit that referenced this pull request Feb 24, 2018
@NejcZdovc
Copy link
Contributor Author

0.21 twitch 9f85d9f

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

Successfully merging this pull request may close these issues.

5 participants