extension icon indicating copy to clipboard operation
extension copied to clipboard

Handle fee estimate request failures when deploying contracts via sandbox

Open 314159265359879 opened this issue 2 years ago • 9 comments

Describe the bug When deploying a contract with the explorer sandbox fee does not load and the transaction to deploy can never be confirmed.

Transaction ID n.a.

To Reproduce Steps to reproduce the behavior:

  1. Go to explorer sandbox on stacks.co and login
  2. Copy code from 'editor' (Excel in this case)
  3. Then press deploy
  4. See error: image

Expected behavior I expect the fee to load and show or I expect the authenticator to throw an encoding error, because that is most likely the cause for this issue.

Screenshots I think there is some kind of problem getting a fee from the estimator. image

image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Firefox and Chrome

Additional context After some more testing it looks like the problem is the encoding. I get this error consistently if I copy code from the sandbox editor, paste that in Excel then copy the same code from Excel and paste it back into the sandbox editor and try to deploy. The workaround is simple and I doubt many coders will use Excel as their preferred editor but I would like to log this anyway. Perhaps the bug will show on other occasions too.

314159265359879 avatar Apr 18 '22 20:04 314159265359879

When using rich text editors, issues can happen primarily in quotes and other special characters, e.g. a normal quote (" U+0022 QUOTATION MARK) gets replaced with (“ U+201C LEFT DOUBLE QUOTATION MARK and ” U+201D RIGHT DOUBLE QUOTATION MARK), this is the case in most environments. I suggest using a plain text editor instead. We might wanna surface an error in the wallet when the fee estimate request fails.

He1DAr avatar Apr 27 '22 07:04 He1DAr

Transferred to web wallet to consider adding error state when the fee estimate request fails.

He1DAr avatar Apr 27 '22 14:04 He1DAr

@He1DAr Are you going to tackle the text editor change elsewhere for the Explorer specifically?

Also, should the API be able to process fee estimate requests with special characters, and if so, should we open an issue in the API repo as well?

I'll retitle this one in particular to better handle fee estimate request failures as suggested.

markmhendrickson avatar Apr 28 '22 09:04 markmhendrickson

I see these issues popping up again. Looks like it still the case when users try to deploy contracts using the sandbox explorer: 1. image

image

image

image

image

image

It would help the user to get more of then "something went wrong" although already better than nothing back when this was first reported ;-) if it is an encoding issue "There is something wrong with the contract name" or "there is an issue with the contract code". If this is happening on all contract deploys via the sandbox perhaps something else is wrong and it will be hard to determine or give more specific error messaging.

Suggested work around: If we get such a fee estimator failure can we allow the user to set a custom fee? or let it default to something like 1 STX (enough for most contracts). Then if something is wrong with the contract, it will fail to deploy and the user may get a better idea of the issue at hand?

314159265359879 avatar Nov 16 '22 19:11 314159265359879

Kenny also resolved this issue by disconnecting the wallet from the sandbox and then reconnecting.

Reproduction steps, thanks to Brice:

  1. Connect to sand box with wallet 1
  2. Sign out of wallet 1 and into wallet 2
  3. Try to deploy from sandbox Can the wallet detect this type of situation and give a nice error?

314159265359879 avatar Nov 16 '22 20:11 314159265359879

When trying to reproduce with above steps, the fees loaded as expected. There is a strange thing happening though, wallet screen blinks.

The wallet blinks with the error shown earlier by Kenny. video: https://user-images.githubusercontent.com/33360391/202305507-78fd8a52-3974-4aa2-96e3-ae273272d609.mp4

Freeze frame or error: image

314159265359879 avatar Nov 16 '22 22:11 314159265359879

This is still popping up and causing blockers for people who use the explorer sandbox to deploy contracts.

image

314159265359879 avatar Sep 06 '23 18:09 314159265359879

Reproduction steps.

  1. go to explorer.hiro.so
  2. go to sandbox via the top nav bar
  3. connect wallet
  4. copy the text from the attached file in the clarity code editor : issue-reproduction-contract.xlsx
  5. and deploy
  6. see error: image

The solution in this case is taking out the "invisible characters" with vsCode, if you paste the code below in the editor instead it is fine. image (contract-call? 'SP2H8PY27SEZ03MWRKS5XABZYQN17ETGQS3527SA5.newyorkcitycoin-core-v1 register-user (none))

314159265359879 avatar Sep 06 '23 18:09 314159265359879

Another way to reproduce the issue is by using a contract name that is longer than allowed (more than 40 characters). The sandbox explorer does not yet validate that.

314159265359879 avatar Sep 08 '23 10:09 314159265359879