Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve challenge validation #31

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Elli610
Copy link
Contributor

@Elli610 Elli610 commented Sep 4, 2024

In the solidity challenges, instead of comparing the user's contract to the one expected, we could compile and test the user's contract in the frontend. That's the purpose of this pr.

Why

Comparing the user's contract as a string with an expected solution is not optimal because it assumes there is only one correct way to write the contract. However, in reality, there can be multiple valid solutions that meet the requirements. For example, in the first challenge, "Data types," both bool myBool = true; and bool public myBool = true; are correct and fulfill the requirements, but a simple string comparison would only recognize one as valid.

How

To address this, I implemented a solution that directly compiles and tests the user's contract in the frontend. By doing this, the code is evaluated based on its functionality and whether it meets the exercise's requirements, rather than its exact syntax or structure. This allows for more flexibility and correctness in determining valid solutions.

Note

Currently, I've only implemented this solution for few challenges as examples. However, the same process can be applied to all other exercises for consistent evaluation. Note that the remaining challenges will not work yet because I have not implemented this solution for them.

You can test this solution for the following challenges:

  • Data types (all exercises)
  • Operator (first one only)
  • Constants (first one only)
  • Immutable (first one only)
  • Variables (first one only)

Copy link

vercel bot commented Sep 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 4, 2024 0:52am

@Elli610 Elli610 changed the title Improve challenge verif Improve challenge validation Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant