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

Support SNIP-9 #1530

Merged
merged 54 commits into from
Dec 16, 2024
Merged

Conversation

baitcode
Copy link
Contributor

@baitcode baitcode commented Dec 2, 2024

Closes #1517

Introduced changes

[x] Added outside execution model, defined hashing
[x] Extended base account interface
[x] Added all utilities to deal with SNIP-9 nonce, interface support queries and generation OutsideExecution call
[x] Cleaned up as much as I could to keep changes minimal
[x] Added a bit of docs
[x] Added one test for positive scenario
[x] Pinned hash calculation for OutsideExecution
[x] Added one test for wrong caller scenario

Small things I had to rework on the way

[x] Moved broadcast transaction generation method closer to usage to get rid of Cyclic dependency
[x] Bugfix type data generation
[x] Allowed for incomplete definition of ParameterDict as contains fields is often missing and linter is.

While implementing the feature I realised better what are the problems of current library implementation. I'd love to discuss those and if it proves that my vision is similar to maintainers I'd love to help fixing those.

@baitcode baitcode marked this pull request as draft December 2, 2024 12:36
@baitcode baitcode force-pushed the feat-snip-9 branch 2 times, most recently from 282d593 to 7f4c71a Compare December 5, 2024 01:43
@baitcode baitcode marked this pull request as ready for review December 5, 2024 01:44
@baitcode
Copy link
Contributor Author

baitcode commented Dec 5, 2024

@franciszekjob Please, take a look.

There are failing checks. I am unsure if I can figure those ones out quickly. Some dependecy does not install in docker. Let me know If you want me investigate.

From the top of stackoverflow:

https://stackoverflow.com/questions/67297760/rust-compilation-error-failed-to-run-custom-build-command-for-freetype-sys-v0

- Added new Transaction models: InvokeOutsideV1, InvokeOutsideV2
- Added method for SNIP9 nonce verification
- Added Account methods for population and broadcasting(execution) of InvokeOutside transactions

Small fixes:
- Allowed for incomplete definition of ParameterDict as `contains` fiels is often missing and linter is complaining.

WIP: miss docs and tests
- Extended base account interface
- Added all utilities to deal with SNIP-9 nonce and generating OutsideExecution call
- Bugfix type data generation
- Cleaned up as much as I could to keep changes minimal
- Added docs
- Added test for positive scenario
- Added one test for wrong caller scenario
* test fixes
@franciszekjob
Copy link
Collaborator

Hi @baitcode 👋
I see you already did a lots of work! I fixed failing build of Docker container. Let me know if you need any help and ping request review once you're ready 😄

@baitcode
Copy link
Contributor Author

baitcode commented Dec 10, 2024

@franciszekjob Hey hey!

I fixed all the required steps. With sad heart I got to admit, that some tests in the project are really bad.
Those to are not reproducible, as they depend on the account that is global and is shared among all other tests (and not immutable):

e2e/client/client_test.py:test_get_storage_at 
e2e/client/client_test.py:test_call_contract 

It's better to remove those. Or create new account for every run.

And yes, I need help with test_on_network. I can't reproduce those, neither can I understand what is wrong. You can start the review.

@franciszekjob
Copy link
Collaborator

franciszekjob commented Dec 10, 2024

@baitcode

I fixed all the required steps. With sad heart I got to admit, that some tests in the project are really bad.
Those to are not reproducible, as they depend on the account that is global and is shared among all other tests (and not immutable)

I see, we can think about refactoring these tests in separate PR. I understand they may have space for improvement.

And yes, I need help with test_on_network. I can't reproduce those, neither can I understand what is wrong. You can start the review.

Tests on networks are failing because you haven't added secrets to your forked repository
You need to add:

  • SEPOLIA_RPC_URL
  • SEPOLIA_ACCOUNT_ADDRESS
  • SEPOLIA_ACCOUNT_PRIVATE_KEY

If you don't have testnet account, you can create one using sncast tool.

Let me know if it works!

@baitcode
Copy link
Contributor Author

@franciszekjob Added repository secrets on my repo. Still not working.

@franciszekjob
Copy link
Collaborator

@baitcode just a couple more comments regarding tests, lmk if you need anything 👍

@baitcode
Copy link
Contributor Author

baitcode commented Dec 16, 2024

@franciszekjob I need help. For some reason argent account doesn't execute v3 transactions. Reverts with error:

'argent/invalid-tx-version'

For now I've reverted execute_v1 method, as it seems that v3 are actually not supported by argent according to that report.

Just to provide a bit more context. Non argent account that is being set up in tests does not provide external execution support.

@franciszekjob
Copy link
Collaborator

For now I've reverted execute_v1 method, as it seems that v3 are actually not supported by argent according to that report.

Fact, right.

Just to provide a bit more context. Non argent account that is being set up in tests does not provide external execution support.

Ok, I see. But that's not a problem, as we're using it to execute, not create outside transaction.

@franciszekjob
Copy link
Collaborator

franciszekjob commented Dec 16, 2024

@baitcode please check out my comments 👍

Copy link
Collaborator

@franciszekjob franciszekjob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also resolve error while building docs 🙏 ?

@baitcode
Copy link
Contributor Author

Sure. I'm on it atm.

@baitcode
Copy link
Contributor Author

@franciszekjob Is there anything left?

Copy link
Collaborator

@franciszekjob franciszekjob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@baitcode
Just these values in tests + could you please mention the change in migration_guide.rst 🙏 ?

starknet_py/tests/e2e/account/outside_execution_test.py Outdated Show resolved Hide resolved
starknet_py/tests/e2e/account/outside_execution_test.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@franciszekjob franciszekjob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply suggested change and we're good to go 🚀

docs/migration_guide.rst Outdated Show resolved Hide resolved
@franciszekjob franciszekjob merged commit a8d7353 into software-mansion:development Dec 16, 2024
9 of 10 checks passed
@franciszekjob
Copy link
Collaborator

Thanks for contribution @baitcode 🤝 tomorrow I will reward you on Only Dust for completing this issue

@baitcode
Copy link
Contributor Author

WOOOOHOOOO. Thanks a lot! @franciszekjob

@baitcode
Copy link
Contributor Author

OMG. I should've squashed commits myself.

@franciszekjob
Copy link
Collaborator

I squashed and merged so it's fine 🤔

@franciszekjob
Copy link
Collaborator

@baitcode you should see the funds on Only Dust 😄

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.

Support SNIP-9
2 participants