flow-playground
flow-playground copied to clipboard
Transaction signer parameters are parsed incorrectly
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


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.
This is a really nice catch, @turbolent I will take a look into it 🙇♂️
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
Fixed