flow-playground icon indicating copy to clipboard operation
flow-playground copied to clipboard

Transaction signer parameters are parsed incorrectly

Open turbolent opened this issue 4 years ago • 2 comments

Describe the bug

The signer / authorizer account selection in the transaction submission box is empty, even though it should allow the selection of an authorizer when the prepare block has account parameters.

To Reproduce

  • Deploy the Hello World contract from https://docs.onflow.org/cadence/tutorial/02-hello-world, i.e. https://play.onflow.org/5b5bd86b-3845-4c16-9a29-626ef6228846 in Account 1
  • Try to submit transaction 1
  • No accounts can be selected to sign the transaction
  • When removing the comment between the import statement and the transaction declaration, which contains the word "prepare", the dialog correctly allows the selection of signer accounts.

Expected behavior

  • Signer selection should always work, even when comments or unrelated code mentions "prepare"

Screenshots

Screen Shot 2021-02-14 at 5 43 40 PM Screen Shot 2021-02-14 at 5 43 54 PM

Desktop (please complete the following information):

  • OS: Any
  • Browser: Any

Additional context

The problem seems to be that the code which extracts the parameters from the prepare block, https://github.com/onflow/flow-playground/blob/d4ec5c6676285fdaf66b9cdda12e8338f6048d1c/src/components/CadenceEditor.tsx#L342-L365, is using ad-hoc parsing to detect a prepare block, but it doesn't account for "prepare" words in comments.

turbolent avatar Feb 15 '21 01:02 turbolent

This is a really nice catch, @turbolent I will take a look into it 🙇‍♂️

MaxStalker avatar Feb 15 '21 03:02 MaxStalker

quickly verified this is still an issue in the current version of Playground. curious if Cadut can suffer the same problem, or how Cadut solved this problem

kerrywei avatar Dec 17 '21 00:12 kerrywei

Fixed

devbugging avatar Mar 30 '23 11:03 devbugging