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: ensure clean-up state after send transaction confirmation #21282

Merged
merged 6 commits into from
Sep 25, 2024

Conversation

seanstrom
Copy link
Member

@seanstrom seanstrom commented Sep 18, 2024

partially fixes #21251

Summary

  • This PR attempts to resolve some issues that have been occurring after sending a transaction.
    • BigNumber errors for "<0.01"
      • It seems we're storing this string "<0.01" for some wallet ui state, but that state can be accidentally used with BigNumber calculations, which can exceptions.
      • Here's where we inject this string into the ui state:
        (assoc acc k (if (money/equal-to v 0) "<0.01" v)))
      • And here's where we are referencing that value:
        (let [{:keys [ethereum optimism arbitrum]} values
        show-optimism? (and optimism
        (or (pos? (:amount optimism))
        (= (:amount optimism) "<0.01")))
        show-arbitrum? (and arbitrum
        (or (pos? (:amount arbitrum))
        (= (:amount arbitrum) "<0.01")))]
        [rn/view
    • Suggest Routes being received after the send transaction is already confirmed
      • It seems like we weren't configuring the wallet send screen to finish requesting the suggested routes data after the user has confirmed the transaction. And as we would continue to receive more suggested route results, the calculations would run with the existing wallet ui state, and that would eventually do some BigNumber comparisons with the string "<0.01" which would cause things to throw.
  • Ideally, we would refactor the code in a way that avoids saving "<0.01" into the database, perhaps we can save an separate keyword like :less-than-something to indicate the same thing. Maybe this would avoid potential number comparison issues in the future.

Testing notes

Platforms

  • Android
  • iOS

Areas that maybe impacted

Functional
  • wallet / transactions

Steps to test

  • Open Status
  • Login as user with funds
  • Navigate to wallet home screen
  • Open account with funds
  • Press the "send" button to start a transaction
  • Choose an account for receiving the transaction
  • Input an amount of funds below 0.01, like 0.001
  • Review and Confirm the transaction

Before and after screenshots comparison

Before Changes

Screen.Recording.2024-09-19.at.08.11.47.mov

After Changes

Screen.Recording.2024-09-19.at.08.10.34.mov

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Sep 18, 2024

Jenkins Builds

Click to see older builds (28)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ df44fb6 #1 2024-09-18 15:16:22 ~4 min tests 📄log
✔️ df44fb6 #1 2024-09-18 15:20:05 ~8 min android-e2e 🤖apk 📲
✔️ df44fb6 #1 2024-09-18 15:20:30 ~8 min android 🤖apk 📲
✔️ df44fb6 #1 2024-09-18 15:25:21 ~13 min ios 📱ipa 📲
✔️ d88e07a #2 2024-09-19 07:12:58 ~4 min tests 📄log
✔️ d88e07a #2 2024-09-19 07:16:16 ~7 min android-e2e 🤖apk 📲
✔️ d88e07a #2 2024-09-19 07:17:40 ~9 min android 🤖apk 📲
✔️ d88e07a #2 2024-09-19 07:19:05 ~10 min ios 📱ipa 📲
✔️ a7c0eab #3 2024-09-19 16:03:13 ~4 min tests 📄log
✔️ a7c0eab #3 2024-09-19 16:06:19 ~7 min android-e2e 🤖apk 📲
✔️ a7c0eab #3 2024-09-19 16:06:49 ~7 min android 🤖apk 📲
✔️ a7c0eab #3 2024-09-19 16:08:17 ~9 min ios 📱ipa 📲
✔️ d901b48 #5 2024-09-20 08:23:59 ~4 min tests 📄log
✔️ d901b48 #5 2024-09-20 08:26:08 ~6 min android-e2e 🤖apk 📲
✔️ d901b48 #5 2024-09-20 08:27:18 ~7 min android 🤖apk 📲
✔️ d901b48 #5 2024-09-20 08:33:38 ~13 min ios 📱ipa 📲
✔️ 7150e34 #7 2024-09-20 09:25:37 ~4 min tests 📄log
✔️ 7150e34 #7 2024-09-20 09:27:56 ~6 min android-e2e 🤖apk 📲
✔️ 7150e34 #7 2024-09-20 09:30:39 ~9 min android 🤖apk 📲
✔️ 7150e34 #7 2024-09-20 09:31:34 ~10 min ios 📱ipa 📲
✔️ 27cbe39 #8 2024-09-20 11:46:53 ~6 min android-e2e 🤖apk 📲
✔️ 27cbe39 #8 2024-09-20 11:50:20 ~9 min ios 📱ipa 📲
✔️ 27cbe39 #8 2024-09-20 11:52:46 ~12 min tests 📄log
✔️ 27cbe39 #8 2024-09-20 11:53:37 ~13 min android 🤖apk 📲
✔️ 0a6252c #9 2024-09-24 09:17:06 ~4 min tests 📄log
✔️ 0a6252c #9 2024-09-24 09:20:46 ~8 min ios 📱ipa 📲
✔️ 0a6252c #9 2024-09-24 09:20:52 ~8 min android-e2e 🤖apk 📲
✔️ 0a6252c #9 2024-09-24 09:21:16 ~9 min android 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ de358d1 #10 2024-09-24 09:37:45 ~5 min tests 📄log
✔️ de358d1 #10 2024-09-24 09:39:59 ~7 min android-e2e 🤖apk 📲
✔️ de358d1 #10 2024-09-24 09:41:14 ~8 min android 🤖apk 📲
✔️ de358d1 #10 2024-09-24 09:47:22 ~14 min ios 📱ipa 📲
✔️ fb8e202 #11 2024-09-25 09:16:23 ~5 min tests 📄log
✔️ fb8e202 #11 2024-09-25 09:18:29 ~7 min android-e2e 🤖apk 📲
✔️ fb8e202 #11 2024-09-25 09:20:28 ~9 min android 🤖apk 📲
✔️ fb8e202 #11 2024-09-25 09:26:09 ~14 min ios 📱ipa 📲

@seanstrom seanstrom force-pushed the seanstrom/fix-transaction-confirmation branch from df44fb6 to d88e07a Compare September 19, 2024 07:08
Copy link
Member Author

@seanstrom seanstrom left a comment

Choose a reason for hiding this comment

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

Self Review 📑

[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn view
[]
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/stop-get-suggested-routes]))
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're configuring the wallet send screen to dispatch the :wallet/stop-get-suggested-routes event when unmounting the component. Without this, it seems that we'll continue to receive suggested route signals, which can cause some glitches because we're re-processing stale wallet send UI state.

Comment on lines 63 to 65
(try
(.eq ^js bn1 n2)
(catch :default _ false))))
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're attempting to prevent exceptions from being thrown because of the BigNumber library failing to do a comparison. Perhaps we should not catch all exceptions here, but I think it's safer to assume that any failure would mean the comparison failed, which would mean the two things are not equal.

But maybe there's a better way to handle these exceptions, thoughts?

Copy link
Contributor

@vkjr vkjr Sep 19, 2024

Choose a reason for hiding this comment

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

@seanstrom, I think that we can avoid try/catch which is not common in our codebase by checking both arguments with (bignumber?) before calling .eq, wdyt?

Copy link
Member

@briansztamfater briansztamfater Sep 19, 2024

Choose a reason for hiding this comment

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

I am not sure what is the best approach, but I've recently updated greater-than less-than and greater-than-or-equals functions with a bignumber? check. The check was only needed on the first argument to avoid the error. We could use the same approach on equal-to for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

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

@briansztamfater, I also think that everything should be wrapped in checks, including second argument, because for equal-to second argument causes exception. I wrote an example down below.

@seanstrom seanstrom marked this pull request as ready for review September 19, 2024 07:19
@shivekkhurana
Copy link
Contributor

shivekkhurana commented Sep 19, 2024

Hi, this issue comment was made into a separate issue and assigned to @vkjr
#21251

@seanstrom your changes look good, if @vkjr has nothing against it we can go forward and use this PR.

@seanstrom
Copy link
Member Author

@shivekkhurana thanks I've updated the PR with the link to the issue 👍

@vkjr based on some of the exceptions I saw when debugging, it could be still useful to refactor the code to avoid saving the "<0.01" into the re-frame database. This PR does not change any of that code, it sorta prevents the exceptions from happening as much, but it could be better to re-structure things. Let me know what you think 🙏

@vkjr
Copy link
Contributor

vkjr commented Sep 19, 2024

@seanstrom, thanks for the PR, it will stop us from having exception. And I will investigate how that "<0.01" makes its way to that function, it shouldn't happen)
cc @shivekkhurana

@vkjr
Copy link
Contributor

vkjr commented Sep 19, 2024

As @seanstrom correctly assumed, the fail happens because re-frame compares previous and new db value and in previous value stored BigNumber, whereas new values is a string that can't be converted to digit. As a result equal-to called with incorrect string as an argument and throws exception.

Throwing exception is expected and covered by tests by @ilmotta here, but I think that overall BigNumber is too fragile and we shouldn't allow it to throw exception. Because result of (equal-to some-bignumber "invalid-string") can easily be false and that will be logically correct.

So my suggestion is to wrap all functions in utils/money with extra checks to avoid any unexpected exceptions. Because as a developer I want to pass random staff into functions and be sure they will survive)
Something like this:

(defn equal-to
  [n1 n2]
  (when-let [^js bn1 (bignumber n1)]
    (when-let [^js bn2 (bignumber n2)]
      (.eq ^js bn1 ^js bn2))))

Wdyt, @seanstrom @ilmotta @shivekkhurana ?

@seanstrom seanstrom force-pushed the seanstrom/fix-transaction-confirmation branch from d88e07a to a7c0eab Compare September 19, 2024 15:58
Copy link
Contributor

@ilmotta ilmotta left a comment

Choose a reason for hiding this comment

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

Ideally, we would refactor the code in a way that avoids saving "<0.01" into the database, perhaps we can save an separate keyword like :less-than-something to indicate the same thing. Maybe this would avoid potential number comparison issues in the future.

Thanks a lot for helping with this bug @seanstrom. I was kind of expecting us to fix the root cause to avoid further problems. Even the names to-network-values-for-ui and from-network-values-for-ui are good hints that they shouldn't be stored in the app-db. Perhaps not too risky to fix the problem because the values are only used by one event which is dispatched from only one place after a signal arrives. The event also has one unit test, that should help a bit.

But of course, could be a follow-up PR, but would be nice if we never stored formatted data in the app-db, unless there's a good reason, like a performance concern where it's very expensive to recompute in subs and the computed data is read heavy much more than write heavy in the UI.

@ilmotta
Copy link
Contributor

ilmotta commented Sep 19, 2024

So my suggestion is to wrap all functions in utils/money with extra checks to avoid any unexpected exceptions. Because as a developer I want to pass random staff into functions and be sure they will survive) Something like this:

I fully agree @vkjr. Throwing an exception is quite bad for users because they bubble up in the whole stack. The bignumber library can throw for various reasons, probably not only because the inputs are not instances of bignumbers. It would be a good idea to take a look at the docs or implementation to see the possible causes of errors because we may need to wrap in a try/catch in some cases.

The other thing we should do ideally is to have a proper layer (data store ns) that always decodes data from status-go into the proper data types for Clojure. If a string arrives and it's supposed to be a bignum, it shouldn't flow throughout the system for too long as a raw string because eventually it can easily reach code that thinks it's a proper number. I've personally faced this problem multiple times in a previous Clojure project.

We extended BigNumber with IEquiv and IComparable, which should help us store them in the app-db and nicely manipulate them. More importantly, it means that if we store bignums in the app-db, re-frame will do the equalities correctly (something we were doing wrong some time ago and caused all subs caches to be invalidated whenever they had instances of bignums)

(extend-type BigNumber

@seanstrom seanstrom force-pushed the seanstrom/fix-transaction-confirmation branch 2 times, most recently from 91c6356 to 7150e34 Compare September 20, 2024 09:20
Copy link
Member Author

@seanstrom seanstrom left a comment

Choose a reason for hiding this comment

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

More self review after updates 📖
Please have a look when you have a chance 🙏
cc @vkjr @briansztamfater @ilmotta

Comment on lines -94 to +91
:from-values-by-chain from-network-values-for-ui
:to-values-by-chain to-network-values-for-ui
:from-values-by-chain from-network-amounts-by-chain
:to-values-by-chain to-network-amounts-by-chain
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's where we were storing the UI strings inside the re-frame state. Now we'll store the original data and do the conversions inside the UI components.

Comment on lines -145 to +146
:values network-values
:values (send-utils/network-values-for-ui network-values)
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's one place we were using the UI strings inside network-values, because summary-info will use the string "<0.01" to determine if some UI should be shown. Not sure what the original intent of that code would be, but perhaps that code could be changed too.

Comment on lines 45 to 74
(defn ->bignumber
[n]
(if (bignumber? n) n (bignumber n)))

(defn ->bignumbers
[& nums]
(let [bignums (map ->bignumber nums)]
(when (every? bignumber? bignums)
bignums)))

(defn greater-than-or-equals
[^js bn1 ^js bn2]
(when (bignumber? bn1)
[^js n1 ^js n2]
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)]
(.greaterThanOrEqualTo bn1 bn2)))

(defn greater-than
[bn1 bn2]
(when (bignumber? bn1)
[n1 n2]
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)]
(.greaterThan ^js bn1 bn2)))

(defn less-than
[bn1 bn2]
(when (bignumber? bn1)
[n1 n2]
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)]
(.lessThan ^js bn1 bn2)))

(defn equal-to
[n1 n2]
(when-let [^js bn1 (bignumber n1)]
(.eq ^js bn1 n2)))
(when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)]
(.eq ^js bn1 bn2)))
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're adding some additional checks for big number instances when using our big number utility functions. Let me what you think 🙏

Copy link
Contributor

Choose a reason for hiding this comment

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

I love this approach!

@status-im-auto
Copy link
Member

71% of end-end tests have passed

Total executed tests: 7
Failed tests: 2
Expected to fail tests: 0
Passed tests: 5
IDs of failed tests: 727230,727229 

Failed tests (2)

Click to expand
  • Rerun failed tests

  • Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230
    Test setup failed: critical/test_wallet.py:29: in prepare_devices
        self.loop.run_until_complete(
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:52: in run_in_parallel
        returns.append(await k)
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../views/sign_in_view.py:303: in recover_access
        self.chats_tab.wait_for_visibility_of_element(30)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: ChatsTab by accessibility id:`chats-stack-tab` is not found on the screen after wait_for_visibility_of_element
    



    2. test_wallet_send_eth, id: 727229

    ## Multiaccount is recovered successfully!
    Device 1: Tap on found: Button

    Test setup failed: critical/test_wallet.py:29: in prepare_devices
        self.loop.run_until_complete(
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:52: in run_in_parallel
        returns.append(await k)
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../views/sign_in_view.py:303: in recover_access
        self.chats_tab.wait_for_visibility_of_element(30)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: ChatsTab by accessibility id:`chats-stack-tab` is not found on the screen after wait_for_visibility_of_element
    



    Passed tests (5)

    Click to expand

    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843
    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    @vkjr
    Copy link
    Contributor

    vkjr commented Sep 20, 2024

    @seanstrom, thanks for the improvements! 🙏

    @seanstrom seanstrom force-pushed the seanstrom/fix-transaction-confirmation branch from 7150e34 to 27cbe39 Compare September 20, 2024 11:40
    @mariia-skrypnyk mariia-skrypnyk self-assigned this Sep 23, 2024
    @status-im-auto
    Copy link
    Member

    86% of end-end tests have passed

    Total executed tests: 7
    Failed tests: 1
    Expected to fail tests: 0
    Passed tests: 6
    
    IDs of failed tests: 703133 
    

    Failed tests (1)

    Click to expand
  • Rerun failed tests

  • Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Device 1: Find `Button` by `accessibility id`: `show-profiles`
    Device 1: Tap on found: Button

    critical/chats/test_public_chat_browsing.py:243: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.errors.verify_no_errors()
    base_test_case.py:192: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     zQ3...dWXh5 was not restored as a contact from waku backup!
    E    zQ3...Vacac was not restored as a contact from waku backup!
    E    admin_open was not restored from waku-backup!!
    E    member_open was not restored from waku-backup!!
    E    admin_closed was not restored from waku-backup!!
    E    member_closed was not restored from waku-backup!!
    



    Device sessions

    Passed tests (6)

    Click to expand

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230
    2. test_wallet_send_eth, id: 727229

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843
    Device sessions

    @mariia-skrypnyk
    Copy link

    Hey @seanstrom !

    Thanks for your fix.
    Checked on both platforms and looks good.
    Great job as usual!
    PR cam be merged.

    Copy link
    Contributor

    @ilmotta ilmotta left a comment

    Choose a reason for hiding this comment

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

    @seanstrom, PR LGTM. My only suggestion is that we avoid making BigNumber instances even slower.

    [n]
    (if (bignumber? n) n (bignumber n)))

    (defn ->bignumbers
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    This function is only used for 1 pair of inputs at a time. Also, for a low-level construct to build instances, I think we should skip the overhead of varargs and processing nums twice with map and every?.

    Because ->bignumber (singular) conveniently returns a BigNumber instance or nil, I think we can skip completely the extra ->bignumbers (plural) function because we can create a vector on the fly, like this:

    ;; PR implementation
    (defn less-than
      [n1 n2]
      (when-let [[^js bn1 ^js bn2] (->bignumbers n1 n2)]
        (.lessThan ^js bn1 bn2)))
    
    ;; Suggestion
    (defn less-than
      [n1 n2]
      (when-let [[^js bn1 ^js bn2] [(->bignumber n1) (->bignumber n2)]]
        (.lessThan bn1 bn2)))

    The suggestion is still as readable, if not more due to the elimination of the extra indirection.

    In terms of benchmarks, this simple change can reduce the time by almost 50% in my tests of less-than. Our conversion of numbers is relatively slow already because we always normalize numbers with money/normalize, which is very odd to be a default. I actually found the original commit that introduced normalization by default and it really makes no sense anymore 06650aecbb because this was added to conveniently allow to add commas in gas inputs, but the vast majority of cases shouldn't need the slow regex processing we do to instantiate bignums.

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Just to be clear @seanstrom, I wouldn't touch the normalization part in this PR. I just wanted to illustrate that creating BigNumber instances is already slow, but this is a part of the code where we should make things fast.

    Copy link
    Member Author

    Choose a reason for hiding this comment

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

    @ilmotta Okay sounds good, I'll try refactoring the code to not use varargs and avoid doing multiple passes on list of bignum inputs.

    One thing to note is that this code:

    (defn less-than
      [n1 n2]
      (when-let [[^js bn1 ^js bn2] [(->bignumber n1) (->bignumber n2)]]
        (.lessThan bn1 bn2)))

    Might not work the same with when-let because we're always returning a vector, and we want to coerce/check if each number is a big number (I think).
    Initially ->bignumbers was a function that used two when-let expressions check if both numbers were bignumbers, but I ended up refactoring to varargs stuff. Though maybe that function is doing too much, and refactoring that function to use transducers might not be worth it either. So I'll reverting back to the double when-let like this:

    (defn ->bignumbers
      [n1 n2]
      (when-let [bn1 (->bignumber n1)]
        (when-let [bn2 (->bignumber n2)]
          (when (and (bignumber? bn1) (bignumber? bn2))
            [bn1 bn2]))))

    This way we still return the vector of numbers when both numbers are valid big numbers. Thoughts?

    Copy link
    Member Author

    Choose a reason for hiding this comment

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

    On a side note, maybe we can update that normalising code to check if the input is a string? Because if the input is not a string I don't think it will have commas present when coerced to a string. That way we may be able to avoid the extra normalising logic for numeric inputs. 💭

    Copy link
    Contributor

    @ilmotta ilmotta Sep 24, 2024

    Choose a reason for hiding this comment

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

    Nice catch @seanstrom, definitely my snippet wouldn't work and I didn't test *properly the snippet I shared. Your new snippet seems correct 👍🏼 What I like about using an optimized arity-2 implementation like what we are doing now is that we can always add arity-x in a backwards compatible way, similar to how cljs.core/+ works.

    On a side note, maybe we can update that normalising code to check if the input is a string?

    I had the impression (no evidence now) that most values we pass to ->bignumber are strings, so maybe this wouldn't be too effective?

    From that original old commit I shared, I think the solution wasn't the best because cleaning up user input is a distant concern for a utility such as money instantiating bignums.

    In the few cases where a bignum has to be created from user input, then the UI code can do the clean-up/normalization explicitly. This would be the best I think, because in all other cases bignums should be instantiated from proper bignum strings sent from the backend, and those shouldn't have formatting chars like ,.

    But probably safer if my suggestion or yours is applied in a separate PR?

    Copy link
    Member Author

    Choose a reason for hiding this comment

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

    Yup yup I think it's better to tweak the normalising logic in a separate pr 👍
    And yeah the two-arity refactor is very nice, thank you 🙌

    @seanstrom seanstrom force-pushed the seanstrom/fix-transaction-confirmation branch 2 times, most recently from 0a6252c to de358d1 Compare September 24, 2024 09:32
    @seanstrom seanstrom force-pushed the seanstrom/fix-transaction-confirmation branch from de358d1 to fb8e202 Compare September 25, 2024 09:11
    @seanstrom seanstrom merged commit 27d1a5f into develop Sep 25, 2024
    6 checks passed
    @seanstrom seanstrom deleted the seanstrom/fix-transaction-confirmation branch September 25, 2024 13:50
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    "eq() not a number: <0.01" Error shown after transaction confirmation
    7 participants