Walletwasabi: #v1.1.12rc Custom fee errors, exceptions and crash

Created on 19 Jul 2020  路  3Comments  路  Source: zkSNACKs/WalletWasabi

General Description

A clear and concise description of what the bug is.

How To Reproduce?

  1. Have "Manual fee entry" On in Settings (TestNet or MainNet)
  2. Go to "Send" tab
  3. Set the values provided on the manual fee box (any numbers works equal)

Screenshots / Details

  • 0.0000000000000000000000000001 is valid

  • 0.00000000000000000000000000001 (and with more decimals too) is invalid

image

  • 0.111111111 ... a lot of decimals is valid

  • 1111111111111 is valid

  • 11111111111111 is invalid

  • 111111111111111111111111111 (and with two more numbers too):

Throws two OverflowException errors and the message under the fee number is now white.

image

If you move the cursor, go to the start or end with the keyboard, add decimals... you get a new OverflowException error each time.

Playing with the previous steps, changing the window focus and writing here (at least the second time I get this), Wasabi force close with this error. I can't reproduce the exact procedure, sorry.

image

2020-07-19 13:14:42 ERROR   SendControlViewModel (404)  System.OverflowException: Value was either too large or too small for a Decimal.
   at System.Number.ThrowOverflowException(TypeCode type)
   at System.Decimal.DecCalc.ScaleResult(Buf24* bufRes, UInt32 hiRes, Int32 scale)
   at System.Decimal.DecCalc.VarDecMul(DecCalc& d1, DecCalc& d2)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.TryParseUserFee(Decimal& userFee)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.SetFees()
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.<.ctor>b__28_35(KeyEventArgs key)
   at ReactiveUI.ReactiveCommand.<>c__DisplayClass2_1`1.<Create>b__1(IObserver`1 observer) in d:\a\1\s\src\ReactiveUI\ReactiveCommand\ReactiveCommand.cs:line 191
   at System.Reactive.Linq.QueryLanguage.CreateWithDisposableObservable`1.SubscribeCore(IObserver`1 observer) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\QueryLanguage.Creation.cs:line 35
   at System.Reactive.ObservableBase`1.Subscribe(IObserver`1 observer) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\ObservableBase.cs:line 78

(...)

2020-07-19 13:40:17 ERROR   SendControlViewModel (404)  System.OverflowException: Value was either too large or too small for a Decimal.
   at System.Number.ThrowOverflowException(TypeCode type)
   at System.Decimal.DecCalc.ScaleResult(Buf24* bufRes, UInt32 hiRes, Int32 scale)
   at System.Decimal.DecCalc.VarDecMul(DecCalc& d1, DecCalc& d2)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.TryParseUserFee(Decimal& userFee)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.SetFees()
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.<.ctor>b__28_35(KeyEventArgs key)
   at ReactiveUI.ReactiveCommand.<>c__DisplayClass2_1`1.<Create>b__1(IObserver`1 observer) in d:\a\1\s\src\ReactiveUI\ReactiveCommand\ReactiveCommand.cs:line 191
   at System.Reactive.Linq.QueryLanguage.CreateWithDisposableObservable`1.SubscribeCore(IObserver`1 observer) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\QueryLanguage.Creation.cs:line 35
   at System.Reactive.ObservableBase`1.Subscribe(IObserver`1 observer) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\ObservableBase.cs:line 78
2020-07-19 13:40:19 ERROR   SendControlViewModel (404)  System.OverflowException: Value was either too large or too small for a Decimal.
   at System.Number.ThrowOverflowException(TypeCode type)
   at System.Decimal.DecCalc.ScaleResult(Buf24* bufRes, UInt32 hiRes, Int32 scale)
   at System.Decimal.DecCalc.VarDecMul(DecCalc& d1, DecCalc& d2)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.TryParseUserFee(Decimal& userFee)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.SetFees()
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.<.ctor>b__28_35(KeyEventArgs key)
   at ReactiveUI.ReactiveCommand.<>c__DisplayClass2_1`1.<Create>b__1(IObserver`1 observer) in d:\a\1\s\src\ReactiveUI\ReactiveCommand\ReactiveCommand.cs:line 191
   at System.Reactive.Linq.QueryLanguage.CreateWithDisposableObservable`1.SubscribeCore(IObserver`1 observer) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\QueryLanguage.Creation.cs:line 35
   at System.Reactive.ObservableBase`1.Subscribe(IObserver`1 observer) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\ObservableBase.cs:line 78
2020-07-19 13:40:29 CRITICAL    Program (58)    System.OverflowException: Value was either too large or too small for a Decimal.
   at System.Number.ThrowOverflowException(TypeCode type)
   at System.Decimal.DecCalc.ScaleResult(Buf24* bufRes, UInt32 hiRes, Int32 scale)
   at System.Decimal.DecCalc.VarDecMul(DecCalc& d1, DecCalc& d2)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.TryParseUserFee(Decimal& userFee)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.SetFees()
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.SetFeesAndTexts()
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.<OnOpen>b__166_4(Decimal _)
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\AnonymousSafeObserver.cs:line 44
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\Sink.cs:line 50
   at System.Reactive.ObserveOnObserverNew`1.DrainStep(ConcurrentQueue`1 q) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 577
   at System.Reactive.ObserveOnObserverNew`1.DrainShortRunning(IScheduler recursiveScheduler) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 509
   at System.Reactive.ObserveOnObserverNew`1.<>c.<.cctor>b__17_0(IScheduler scheduler, ObserveOnObserverNew`1 self) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 497
   at Avalonia.Threading.AvaloniaScheduler.Schedule[TState](TState state, TimeSpan dueTime, Func`3 action)
   at System.Reactive.ObserveOnObserverNew`1.Schedule() in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 477
   at System.Reactive.ObserveOnObserverNew`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 463
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\Sink.cs:line 50
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Linq.ObservableImpl.DistinctUntilChanged`2._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\DistinctUntilChanged.cs:line 74
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Linq.ObservableImpl.Switch`1._.InnerObserver.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Switch.cs:line 103
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Linq.ObservableImpl.Cast`2._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Cast.cs:line 41
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Subjects\Subject.cs:line 148
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.EnumerableSelector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\SelectMany.cs:line 1351
   at System.Reactive.Linq.ObservableImpl.Buffer`2.Boundaries._.BufferClosingObserver.OnNext(TBufferClosing value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Buffer.cs:line 831
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Merge.cs:line 238
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Subjects\Subject.cs:line 148
   at ReactiveUI.IReactiveObjectExtensions.ExtensionState`1.NotifyObservable[T](TSender rxObj, T item, ISubject`1 subject) in d:\a\1\s\src\ReactiveUI\ReactiveObject\IReactiveObjectExtensions.cs:line 397
   at ReactiveUI.IReactiveObjectExtensions.ExtensionState`1.RaisePropertyChanged(String propertyName) in d:\a\1\s\src\ReactiveUI\ReactiveObject\IReactiveObjectExtensions.cs:line 380
   at ReactiveUI.OAPHCreationHelperMixin.<>c__DisplayClass4_0`2.<ObservableToProperty>b__0(TRet _) in d:\a\1\s\src\ReactiveUI\ObservableForProperty\OAPHCreationHelperMixin.cs:line 239
   at ReactiveUI.ObservableAsPropertyHelper`1.<>c__DisplayClass7_0.<.ctor>b__1(T x) in d:\a\1\s\src\ReactiveUI\ObservableForProperty\ObservableAsPropertyHelper.cs:line 115
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\AnonymousSafeObserver.cs:line 44
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\Sink.cs:line 50
   at System.Reactive.ObserveOnObserverNew`1.DrainStep(ConcurrentQueue`1 q) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 577
   at System.Reactive.ObserveOnObserverNew`1.DrainShortRunning(IScheduler recursiveScheduler) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 509
   at System.Reactive.ObserveOnObserverNew`1.<>c.<.cctor>b__17_0(IScheduler scheduler, ObserveOnObserverNew`1 self) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 497
   at Avalonia.Threading.AvaloniaScheduler.<>c__DisplayClass2_1`1.<Schedule>b__1()
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority)
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
   at AvalonStudio.Shell.Shell.StartShellApp[TAppBuilder](TAppBuilder builder, String appName, ShellAppMainDelegate main, String[] args, IFactory layoutFactory)
   at WalletWasabi.Gui.Program.Main(String[] args)
2020-07-19 13:40:29 WARNING Program (160)   System.OverflowException: Value was either too large or too small for a Decimal.
   at System.Number.ThrowOverflowException(TypeCode type)
   at System.Decimal.DecCalc.ScaleResult(Buf24* bufRes, UInt32 hiRes, Int32 scale)
   at System.Decimal.DecCalc.VarDecMul(DecCalc& d1, DecCalc& d2)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.TryParseUserFee(Decimal& userFee)
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.SetFees()
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.SetFeesAndTexts()
   at WalletWasabi.Gui.Controls.WalletExplorer.SendControlViewModel.<OnOpen>b__166_4(Decimal _)
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\AnonymousSafeObserver.cs:line 44
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\Sink.cs:line 50
   at System.Reactive.ObserveOnObserverNew`1.DrainStep(ConcurrentQueue`1 q) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 577
   at System.Reactive.ObserveOnObserverNew`1.DrainShortRunning(IScheduler recursiveScheduler) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 509
   at System.Reactive.ObserveOnObserverNew`1.<>c.<.cctor>b__17_0(IScheduler scheduler, ObserveOnObserverNew`1 self) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 497
   at Avalonia.Threading.AvaloniaScheduler.Schedule[TState](TState state, TimeSpan dueTime, Func`3 action)
   at System.Reactive.ObserveOnObserverNew`1.Schedule() in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 477
   at System.Reactive.ObserveOnObserverNew`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 463
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\Sink.cs:line 50
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Linq.ObservableImpl.DistinctUntilChanged`2._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\DistinctUntilChanged.cs:line 74
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Linq.ObservableImpl.Switch`1._.InnerObserver.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Switch.cs:line 103
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Linq.ObservableImpl.Cast`2._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Cast.cs:line 41
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Subjects\Subject.cs:line 148
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.EnumerableSelector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\SelectMany.cs:line 1351
   at System.Reactive.Linq.ObservableImpl.Buffer`2.Boundaries._.BufferClosingObserver.OnNext(TBufferClosing value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Buffer.cs:line 831
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Merge.cs:line 238
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 48
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Subjects\Subject.cs:line 148
   at ReactiveUI.IReactiveObjectExtensions.ExtensionState`1.NotifyObservable[T](TSender rxObj, T item, ISubject`1 subject) in d:\a\1\s\src\ReactiveUI\ReactiveObject\IReactiveObjectExtensions.cs:line 397
   at ReactiveUI.IReactiveObjectExtensions.ExtensionState`1.RaisePropertyChanged(String propertyName) in d:\a\1\s\src\ReactiveUI\ReactiveObject\IReactiveObjectExtensions.cs:line 380
   at ReactiveUI.OAPHCreationHelperMixin.<>c__DisplayClass4_0`2.<ObservableToProperty>b__0(TRet _) in d:\a\1\s\src\ReactiveUI\ObservableForProperty\OAPHCreationHelperMixin.cs:line 239
   at ReactiveUI.ObservableAsPropertyHelper`1.<>c__DisplayClass7_0.<.ctor>b__1(T x) in d:\a\1\s\src\ReactiveUI\ObservableForProperty\ObservableAsPropertyHelper.cs:line 115
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\AnonymousSafeObserver.cs:line 44
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\Sink.cs:line 50
   at System.Reactive.ObserveOnObserverNew`1.DrainStep(ConcurrentQueue`1 q) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 577
   at System.Reactive.ObserveOnObserverNew`1.DrainShortRunning(IScheduler recursiveScheduler) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 509
   at System.Reactive.ObserveOnObserverNew`1.<>c.<.cctor>b__17_0(IScheduler scheduler, ObserveOnObserverNew`1 self) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Internal\ScheduledObserver.cs:line 497
   at Avalonia.Threading.AvaloniaScheduler.<>c__DisplayClass2_1`1.<Schedule>b__1()
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority)
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
   at AvalonStudio.Shell.Shell.StartShellApp[TAppBuilder](TAppBuilder builder, String appName, ShellAppMainDelegate main, String[] args, IFactory layoutFactory)
   at WalletWasabi.Gui.Program.Main(String[] args)
2020-07-19 13:40:33 WARNING Global (645)    Process is exiting.
  • 111111111111111111111111111111 is invalid again ( ! )

Ideas

  • Restrict the maximum number of decimal numbers in a fixed way (could any standard be used here?).

  • Throw an error if the amount of the selected fee can produce an expense equal or greater than the selected BTC (or the max amount avaliable in the wallet?). Don't sure if is recommended but at least a warning here can be a lot of valuable to prevent human mistakes.

Operating System

Windows 10. Version 10.0.18363. Compilation 18363

Wasabi Version

Release Candidate for 1.1.12 (#3782)

debug

Most helpful comment

@ibertario thanks for the detailed report.
Similar to #3485 but not a duplicate, these issues should be fixed altogether.

All 3 comments

@ibertario thanks for the detailed report.
Similar to #3485 but not a duplicate, these issues should be fixed altogether.

that's a great report, thanks!
can reproduce - 2 points

seems like the problematic line in here is:
https://github.com/zkSNACKs/WalletWasabi/blob/master/WalletWasabi.Gui/Controls/WalletExplorer/SendControlViewModel.cs#L843

if 111111111111111111111111111111 is multiplied by 1000, it overflows :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

molnard picture molnard  路  3Comments

the-metalworker picture the-metalworker  路  3Comments

2pac1 picture 2pac1  路  3Comments

UkolovaOlga picture UkolovaOlga  路  3Comments

trading2835 picture trading2835  路  3Comments