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

test: fn get_starknet_address #991

Closed
enitrat opened this issue Sep 28, 2024 · 4 comments · Fixed by #1006
Closed

test: fn get_starknet_address #991

enitrat opened this issue Sep 28, 2024 · 4 comments · Fixed by #1006
Assignees
Labels
enhancement New feature or request ODHack8

Comments

@enitrat
Copy link
Collaborator

enitrat commented Sep 28, 2024

test fn get_starknet_address to ensure

  1. if the address is registered in the mapping, it's returned
  2. if not, we return the result of the computation

the test will use starknet-foundry's "store" and "load" cheatcodes, as already used in:
https://github.com/lordshashank/kakarot-ssj/blob/ed7e4145a0bb2517c60c6904fd317d11d1b00625/crates/contracts/tests/test_kakarot_core.cairo#L96-L131

The logic should be:
for 1. you can just put any value in the mapping and verify it's returned
for 2., make sure the mapping is empty, and that get_starknet_address returns the same as compute_starknet_address.

reserved for @saimeunt

@Damilola145
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello,I'm a front-end developer with a resolve to confront and solve new challenges. This alongside my experience will aid me in resolving this issue

How I plan on tackling this issue

I would carefully go through the github link highlighted to aid the implementation of the cheatcodes to resolve the issue, and also carry out the test as required

@ScottyDavies
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a blockchaindevelopereveloper

How I plan on tackling this issue

I would approach this issue with the following steps:

For Testing Address Registration:
Add a value to the mapping.
Verify that the expected value is returned when calling get_starknet_address.

For Testing Computation:
Ensure the mapping is empty.
Check that get_starknet_address returns the same value as compute_starknet_address.

@saimeunt
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a returning contributor and I have some experience in Cairo testing.

How I plan on tackling this issue

I will carefully implement the test as explained in the issue description.

@akintewe
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have a degree in computer science and am a mobile developer with experience in TypeScript and Python, among other programming languages. Although I haven't worked with Cairo directly, I have a strong grasp of Starknet's architecture because to my experience developing smart contracts for other blockchain platforms. My background in test-driven development and unit testing in a variety of settings will be helpful in putting thorough tests for the get_starknet_address function in place.

How I plan on tackling this issue

I would begin by reviewing the current codebase, paying close attention to the test file you mentioned and the get_starknet_address method. With the cheatcodes from starknet-foundry, I would then write a new test function. In the first test case, I would use get_starknet_address and assert that it returns the stored value after adding a known address to the mapping using the "store" cheatcode. In order to validate that the results of get_starknet_address and compute_starknet_address are identical in the second scenario, I would first make sure the mapping is empty. Before submitting a pull request with the new test cases and any required documentation modifications, I would run the tests locally to make sure they pass.

@github-project-automation github-project-automation bot moved this from 🆕 Backlog to ✅ Done in Kakarot's Project Management Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ODHack8
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants