Skip to content

Issue sponsoring transaction #22306

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

Open
spielcrypto opened this issue Jun 4, 2025 · 15 comments
Open

Issue sponsoring transaction #22306

spielcrypto opened this issue Jun 4, 2025 · 15 comments
Assignees

Comments

@spielcrypto
Copy link

spielcrypto commented Jun 4, 2025

When I try to execute this endpoint from Enoki I get this error The specified transaction kind bytes are invalid

  • Here is the method that I call from my lib squard_connect to sponsor transaction
  • Here is the logic to call such endpoint
  • If I don't sponsor the transaction, I can execute successfully

Also I don't understand in the response of this endpoint what is exactly bytes, is it signature?

{
  "data": {
    "digest": "string",
    "bytes": "string"
  }
}
Copy link
Contributor

github-actions bot commented Jun 4, 2025

Thank you for opening this issue, a team member will review it shortly. Until then, please do not interact with any users that claim to be from Sui support and do not click on any links!

@Jordan-Mysten
Copy link
Contributor

It looks like you're sending the complete transaction bytes to the endpoint, but the endpoint takes only the bytes for the transaction kind. There's an example for how to construct these bytes with the TS SDK here: https://sdk.mystenlabs.com/typescript/transaction-building/sponsored-transactions

@spielcrypto
Copy link
Author

thanks for your answer, but I need to know how to do with Rust SDK because I tried several things without success.

@stefan-mysten
Copy link
Contributor

@spielcrypto I don't think the Rust SDK supports that kind of transaction building, but let me check internally.

@stefan-mysten
Copy link
Contributor

@spielcrypto you'll need to build a TransactionKind and then serialize that to bcs using bcs::to_bytes. I hope this will be sufficient, but if not, please share some code and will try to help more.

@spielcrypto
Copy link
Author

@stefan-mysten I still have this issue from the endpoint:

Network error: Submit sponsor transaction request failed with status 400 Bad Request: {"errors":[{"code":"gas_station_error","message":"Request to gas station failed","data":{"status":400,"text":"{\"effects\":null,\"error\":\"Invalid bcs bytes for TransactionData\"}"}}]}",

here you can find the logic implemented:
https://github.com/Singularity-Shift/squard_connect/blob/feat/fix-sponsor-implementation/src/service/services.rs#L304

I need to convert to String otherwise the Enoki API will fail showing that the type of bcs is not correct

@stefan-mysten
Copy link
Contributor

@spielcrypto unfortunately, I am not familiar with the Enoki API. Perhaps it does not need to be Base64 encoded? Did you try that?

@stefan-mysten
Copy link
Contributor

Otherwise, your code looks fine from the tx kind perspective.

@hayes-mysten
Copy link
Contributor

I am out for the weekend, but I did a quick search for this error. Interestingly, it comes from the gas station rather than enoki itself: https://github.com/MystenLabs/sui-gas-pool/blob/d65e4c2e768f87e5c3c4b5e4975302b475e84739/src/rpc/server.rs#L236

@spielcrypto
Copy link
Author

About Base64, the endpoint only accept String, If I send Vec<8> which is what I get after using this bcs::to_bytes, the endpoint will throw an error show me that the type of TransactionData is not correct.

About what you mention of Sui Gas Pool, I see that try to get the TransactionData and GenericSignature but I don't send any of the second only TransactionData, what should I do?

@stefan-mysten
Copy link
Contributor

Not sure what to suggest, I'd have to sit down and try to replicate this in Rust.

Perhaps what you need to do, following the way it's done in the TS SDK example is to

  • create a transaction, make it a programmable transaction, and then get the kind of that transaction and serialize it to bcs.
  • create a new transaction from this first transaction, and then add all the details required: sender, gas data, signatures, etc, and that's the one you send to Enoki API.

@stefan-mysten
Copy link
Contributor

As you can see in the TS SDK example, there's a bit more to it:

sponsoredtx.setSender(sender);
sponsoredtx.setGasOwner(sponsor);
sponsoredtx.setGasPayment(sponsorCoins);

@stefan-mysten
Copy link
Contributor

@spielcrypto ignore my comment above, it's wrong.

@spielcrypto
Copy link
Author

spielcrypto commented Jun 10, 2025

@stefan-mysten ok anyway we won't continue until Alex from your team answer my question

@spielcrypto
Copy link
Author

spielcrypto commented Jun 10, 2025

also @stefan-mysten after get such unpolite feedback in the SUI Overflow Hackathon (which shows that even the reviewer didn't go through the project) after our hard work and contribution plus be ignored by your colleague Alex which motivated us to build a helper module of Rust with ZKInputs which we did ( https://github.com/Singularity-Shift/squad_connect ) we are thinking than probably is not worth to continues building in this network.

Image

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

No branches or pull requests

4 participants