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

SNIP-06 #165

Merged
merged 5 commits into from
Jun 7, 2024
Merged

SNIP-06 #165

merged 5 commits into from
Jun 7, 2024

Conversation

maciejka
Copy link
Collaborator

@maciejka maciejka commented Jun 6, 2024

No description provided.

Copy link

vercel bot commented Jun 6, 2024

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

Name Status Preview Comments Updated (UTC)
joyboy ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2024 1:28pm
joyboy-webapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2024 1:28pm

@mubarak23
Copy link
Contributor

add snforge prank so that calling contract will be account contract and a demo user created via contract_address_const::<0>()


  #[test]
    fn is_valid_signature_success() {
        // private key: 70aca2a9ab722bd56a9a1aadae7f39bc747c7d6735a04d677e0bc5dbefa71d47
        // just for testing, do not use for anything else
        let public_key =
            0xd6f1cf53f9f52d876505164103b1e25811ec4226a17c7449576ea48b00578171_u256;

        let account_class = declare_account();
        let account = deploy_account(account_class, public_key);
        // TODO: cleanup

         snf::start_prank(CheatTarget::One(account.contract_address), contract_address_const::<0>());

        let account = ISRC6Dispatcher { contract_address: account.contract_address};

        let hash = 123;

        let r = 1_u256;
        let s = 2_u256;

        let mut signature = Default::default();
        r.serialize(ref signature);
        s.serialize(ref signature);

        assert!(account.is_valid_signature(hash, signature) == starknet::VALIDATED);
        snf::stop_prank(CheatTarget::One(account.contract_address));
    }

@maciejka
Copy link
Collaborator Author

maciejka commented Jun 7, 2024

How does this fix the test?

@mubarak23
Copy link
Contributor

How does this fix the test?

i use start and stop prank to changes the caller's address and contract address to execute the function on

@mubarak23
Copy link
Contributor

with the test data,

bip340::verify is returning this

result of bip340::verify is : false

@mubarak23
Copy link
Contributor

changing the hash value will fix the test

@maciejka
Copy link
Collaborator Author

maciejka commented Jun 7, 2024

changing the hash value will fix the test

No need to use pranks here. I already fixed it.

@mubarak23
Copy link
Contributor

changing the hash value will fix the test

No need to use pranks here. I already fixed it.

awesome, welldone

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.

2 participants