flamingo-finance / flamingo-contract-swap

7 stars 5 forks source link

Assert bug: notification name length exceeded maximum allowed value #10

Closed AnnaShaleva closed 3 years ago

AnnaShaleva commented 3 years ago

Describe the bug There are several Assert helpers inside the Flamingo contract. All of these halpers use Notify("Fault:" + message); construction, i.e. System.Runtime.Notify syscall with the "Fault:" + message notification name.

The maximum allowed length for the notification name is 32 (see the link). However, method Mint uses Assert(liquidity > 0, "INSUFFICIENT_LIQUIDITY_MINTED");, so the resulting notification name is Fault:INSUFFICIENT_LIQUIDITY_MINTED with the length = 35. This notification will never be emitted because the invocation will be FAULTed due to bad name length.

Please, check that all your notifications names have length <= 32.

Expected behavior All notifications emitted by Assert functions have the proper length <= 32.

Platform:

erikzhang commented 3 years ago

I think you should use Log instead of Notify.

cloud8little commented 3 years ago

I think you should use Log instead of Notify.

But the log did not do anything.