Skip to content

Conversation

Salonii02
Copy link

@Salonii02 Salonii02 commented Jun 30, 2025

Summary

This pull request introduces supporting methods for the SNIP-29 Applicative Paymaster API, enabling off-chain paymaster integration for sponsored and flexible transaction fee payments.
This PR closes #745.

Key Changes

  • A new paymaster pkg was created in the root of the repository to provide a dedicated interface for the paymaster API.
  • It implements all methods from the OpenRPC specification: https://github.com/starknet-io/SNIPs/blob/main/assets/snip-29/paymaster_api.json
    • paymaster_isAvailable
    • paymaster_getSupportedTokens
    • paymaster_buildTransaction
    • paymaster_executeTransaction
    • paymaster_trackingIdToLatestHash
  • Mock and integration tests with the AVNU paymaster to assert correctness.
  • New CI workflow to continuously verify the paymaster functionality.
  • New paymaster example in the example folders showing how to use it.

@thiagodeev
Copy link
Collaborator

Thank you @Salonii02!
I'll do my best to review it tomorrow

@thiagodeev
Copy link
Collaborator

Hi @Salonii02!
Unfortunately, due to the proximity of Starknet v0.14.0 + RPC v0.9.0 update in Sepolia, I'll pause the reviews for a few days to release a compliant Starknet.go version ASAP.
Hope you understand 🙌

@Salonii02
Copy link
Author

Hi @Salonii02! Unfortunately, due to the proximity of Starknet v0.14.0 + RPC v0.9.0 update in Sepolia, I'll pause the reviews for a few days to release a compliant Starknet.go version ASAP. Hope you understand 🙌

Okay Thanks!! No worries, will wait for the review.

@Salonii02
Copy link
Author

Hi @Salonii02! Unfortunately, due to the proximity of Starknet v0.14.0 + RPC v0.9.0 update in Sepolia, I'll pause the reviews for a few days to release a compliant Starknet.go version ASAP. Hope you understand 🙌

Hey @thiagodeev Did you get chance to review my changes

@thiagodeev
Copy link
Collaborator

Hey! Sorry @Salonii02, not yet. All PR reviews are still paused until the final rpc v0.9 release.
But I can see the CI is failing with some errors. You can fix them in the meantime

@tarrencev
Copy link
Contributor

Looking forward to this landing!

@thiagodeev
Copy link
Collaborator

Hey @Salonii02!
I've pushed some commits to the PR, and will be making more hehe. I'm currently working directly on this feature.
I'm leveraging your work. Thanks again!
I'll give you an overview of the changes at the end of my work and a review of yours.

@Salonii02
Copy link
Author

Hey @Salonii02! I've pushed some commits to the PR, and will be making more hehe. I'm currently working directly on this feature. I'm leveraging your work. Thanks again! I'll give you an overview of the changes at the end of my work and a review of yours.

Okay thanks!! Looking forward to it

@thiagodeev thiagodeev force-pushed the implement-SNIP-29-issue-745 branch 3 times, most recently from a44fda4 to e05372f Compare September 15, 2025 14:14
@thiagodeev thiagodeev force-pushed the implement-SNIP-29-issue-745 branch from d2f2a71 to 1164214 Compare September 18, 2025 19:46
- The test mocks the paymaster environment and checks the response against expected values.
- Ensured proper error handling and JSON response validation within the test.
- Moved the TxnStatus enum and its JSON marshaling/unmarshaling methods from types_paymaster.go to tracking_id.go for better organization.
- Since the file only has error types, makes sense to rename it
- It has no other use inside the code than asserting implementation
- Made the Tip field in FeeMode optional,  and returns nothing if it is ommited. No magic side effects in the MarshalJSON method.
- Updated comments for better understanding of default behaviors.
- Adjusted JSON test data to reflect changes in the FeeMode structure.
- Introduced a new example in the`examples/` folder demonstrating the usage of the paymaster provider.
- Added a new `deploy.go` file showing how to use the paymaster to deploy an account sending a `deploy` txn.
- Introduced a constant for the AVNU paymaster URL to improve code readability.
- Added a new `deploy_and_invoke.go` file showing how to use the paymaster to deploy an account and invoke a txn by sending a `deploy_and_invoke` txn.
- Introduced a new function to retrieve the AVNU_API_KEY from the environment.
- Updated paymaster example files to load the AVNU_API_KEY for deployment and invocation.
- Modified the README to include instructions for setting the AVNU_API_KEY in the .env file.
- Added a new section in the main README to link to the paymaster example.
- Updated examples README to provide instructions on how to interact with the paymaster and send transactions.
- Created a new GitHub Actions workflow for running integration tests on the paymaster module.
- Updated the existing test workflow to include building the paymaster directory.
Copy link
Collaborator

@thiagodeev thiagodeev left a comment

Choose a reason for hiding this comment

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

Hey @Salonii02, my work is finished!
Paymaster is working and well tested.

Here's my review as promised:

I can't help but assume you used AI for most of your work.
Even the original PR description seems mostly AI-generated. Please correct me if I'm wrong.

Some errors of the initial code:

  • The initial NewPaymasterClient function initializes a paymaster using the rpc.NewProvider function, which expects a Starkent RPC provider, not a paymaster. This alone is sufficient to make it impossible to instantiate a paymaster with this function, because inside the rpc.NewProvider function, there's a call to the starknet_specVersion RPC method, which would fail since the paymaster is not a Starknet RPC provider.
  • You created a lot of boilerplate code that Starknet.go already has. The entire OutsideExecution... part could be handled by the typedData pkg, which is our implementation for the SNIP-12, used by the paymaster to sign the off-chain data
  • All these errors did not appear due to a simple fact: your tests were almost useless.
    Take a look again at the TestPaymasterTypes test. You are simply manually instantiating some types and checking if they are not nil. Of course they are not nil! You manually initialized them.
    There is not a single test that does a real call to a paymaster and asserts the client's functionality. If you have done a real interaction with a Paymaster using your code, you would see that it was not working.

My conclusion is: either you did not pay enough attention to the Paymaster feature and also need to improve your testing mindset, or worse, you used AI for almost everything and did not even check the result (I think this is the case).

So, my advice for you:

  • You can't use AI to do your work; this will disrupt your learning.
  • Use AI to help you understand things, or to do repetitive tasks that you already know how to do.
  • Always check your code with real scenarios, or the closest possible ones. If you have not tested it, you can't know it works.
  • When contributing to a project, take time to search the codebase for what is already built so that you can use it instead of wasting time creating more code. But it's okay to also ask for help.

Hope that helps you in your journey. Thanks again for the kickstart!
The code will now be reviewed by my other teammates. It would be great to have your review on my code as well!

@github-project-automation github-project-automation bot moved this from 🔖 To do to 👀 In review in [Nubia] Starknet.go Oct 1, 2025
@thiagodeev
Copy link
Collaborator

Hey @Salonii02!
Just to let you know: for the PR to be better reviewed by the team, I'll break it down into small pieces. But this is just about revision. At the end, this current PR is the one that will be merged. This way, your contribution gets the deserved credit.

I'll merge this once all the changes have been reviewed

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

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

implement SNIP-29

3 participants