Skip to content

Conversation

@babcoccl
Copy link

@babcoccl babcoccl commented Mar 13, 2024

Remove comments so Test assertion will pass.

Algorand Coding Challenge Submission

What was the bug?
I thought the error was simply ensuring the return statement was uncommented so the unit test assertion would pass, however, I received the an error about the contract failing to generate error after running algokit bootstrap all. The error wasn't detailed and provided no guidance on what was wrong. I went to the algorand developer discord and saw some other asks about issues with Challenge two and the suggestion was to change the generate client command in package.json to: "algokitgen generate -a contracts/artifacts/AlgorandPuzzle2.arc32.json -o contracts/clients/AlgorandPuzzle2Client.ts" Whereas previously it was using a dynamic variable for name assignment among other things (different command params etc.) I made the change and the contract gen error resolved and the contract generated successfully. Running the unit tests via npm now succeeded.

How did you fix the bug?
I went to the algorand developer discord and saw some other asks about issues with Challenge two and the suggestion was to change the generate client command in package.json to: "algokitgen generate -a contracts/artifacts/AlgorandPuzzle2.arc32.json -o contracts/clients/AlgorandPuzzle2Client.ts"

Console Screenshot:
image

Remove comments so Test assertion will pass.
@iskysun96
Copy link
Contributor

how did you set up your dev environment? did you use a specific algokit command?

@babcoccl babcoccl marked this pull request as ready for review March 14, 2024 13:10
@babcoccl
Copy link
Author

how did you set up your dev environment? did you use a specific algokit command?

Sorry, got sidetracked last night when I started this and didn't have time to complete till this morning. I had left the PR in a draft state so hopefully you wouldn't have to review :-)

@iskysun96
Copy link
Contributor

Nice work finding a workaround to solve the error! It wasn't part of this challenge but we witnessed this error from multiple participants. Could you try updating your AlgoKit to the latest version and see if the original way of generating the client works?

🎉 Congrats on solving the 2nd Algorand Coding Challenge!

I have labeled your PR approved so you can now claim your certificate.

You can claim your certificate of completion NFT here:
https://goplausible.xyz/claim/f5ctf17aqhhzxxhrjgzye58g5fa07tr9x7q1j595041m2t7drgkx4z87neww65f81ehyvkxd7qp0f21pzg7vpdne0vqrncc7m1bv02g

@iskysun96 iskysun96 added the Approved ✅ Successfully completed the challenge! label Mar 14, 2024
@babcoccl
Copy link
Author

babcoccl commented Mar 14, 2024

Nice work finding a workaround to solve the error! It wasn't part of this challenge but we witnessed this error from multiple participants. Could you try updating your AlgoKit to the latest version and see if the original way of generating the client works?

🎉 Congrats on solving the 2nd Algorand Coding Challenge!

I have labeled your PR approved so you can now claim your certificate.

You can claim your certificate of completion NFT here: https://goplausible.xyz/claim/f5ctf17aqhhzxxhrjgzye58g5fa07tr9x7q1j595041m2t7drgkx4z87neww65f81ehyvkxd7qp0f21pzg7vpdne0vqrncc7m1bv02g

Sure thing, here's the steps I'm taking to reproduce:

  1. npm cache clean --force locally
  2. Branch off my fork from main, ensure code is "vanilla" to the challenge:
    image
  3. Run algokit localnet start as per instructions
  4. Uncomment Line 8 as per instructions
  5. Run unit test
    image
    Ok, probably missing dependencies.
  6. Verify Algokit version:
    image
  7. run algokit boostrap all (attempting to reproduce error):
    image
  8. run unit tests (npm run test) Error:
    image
  9. Issue I first assumed in contract gen:
    image
    No equivalent CreateApplication() but might get inherited?
    image
  10. Anyway, let's force upgrade algokit to latest and npm install:
    image
    Generator Latest^^
    Utils one minor behind, update package to 5.5.1 instead of ^ (carrots are bad):
    image
    image
    Tealscript two versions behind, update to 0.88:
    image
    image
    Algosdk three minor versions behind:
    image
    Update:
    image
  11. npm clean cache --force
  12. run algokit boostrap all
  13. npm run test
  14. No joy:
    image

@iskysun96
Copy link
Contributor

so algokit-utils is different from algokit. could you try updating algokit to the latest version? if you used pipx its pipx upgrade algokit

@babcoccl
Copy link
Author

babcoccl commented Mar 14, 2024

so algokit-utils is different from algokit. could you try updating algokit to the latest version? if you used pipx its pipx upgrade algokit

Yeah def, sorry I was misunderstanding what sdk we were talking about, fwiw, I just installed algokit yesterday as per the instructions in the challenge so my whole install was "fresh" on system that's never had algokit before.

here we go, starting with the same place I left off on above:
image

huh that's weird because when I do this I get v 1.4.3:
image

Any thoughts?

P.S. Here's the version for algokit:
image

P.P.S. Looks like that is the latest according to Github tags:
image

@iskysun96
Copy link
Contributor

hmm weird. could you try running algokit -v generate client contracts/artifacts/ --language typescript --output contracts/clients/AlgorandPuzzle2Client.ts to get more details on what is going on?

@babcoccl
Copy link
Author

babcoccl commented Mar 14, 2024

hmm weird. could you try running algokit -v generate client contracts/artifacts/ --language typescript --output contracts/clients/AlgorandPuzzle2Client.ts to get more details on what is going on?

image
After that I manually npm installed lstat and reran but it gave me the same error again.
P.S. After I did a local npm install of lstat I tried a global install, global install fixed the issue and the code generated:
image

@iskysun96
Copy link
Contributor

Thank you @babcoccl ❤️ We will investigate and find out what's wrong!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved ✅ Successfully completed the challenge!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants