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

build(connector-stellar): add a run soroban transaction endpoint #3296

Conversation

fazzatti
Copy link
Contributor

@fazzatti fazzatti commented Jun 4, 2024

  • Add a run soroban transaction endpoint to the Stellar Connector plugin.

Remarks:

The runSorobanTransaction endpoint can be used to make smart contract invocations on the Soroban platform. The endpoint accepts a flag called readOnly to indicate when the transaction should not alter ledger state. When true, the transaction will only be simulated based on the current ledger state and provide an up-to-date output without registering the transaction to the ledger, ensuring no fees are consumed. When false, the transaction will be executed and registered to the ledger even if it doesn't alter the ledger state, incurring fees as usual.

More details can be found in the README.md file under the connector root directory.

Closes #3238

Pull Request Requirements

  • Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

@fazzatti fazzatti force-pushed the feat-stellar-ledger-connector-run-soroban-transaction branch from 83062c7 to 711fa0a Compare June 4, 2024 13:54
@fazzatti fazzatti marked this pull request as ready for review June 4, 2024 16:09
Copy link
Member

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@fazatti ^^ Please see comments above!

@fazzatti fazzatti force-pushed the feat-stellar-ledger-connector-run-soroban-transaction branch 2 times, most recently from 8e25235 to e1206b0 Compare June 10, 2024 13:19
@fazzatti fazzatti requested a review from petermetz June 10, 2024 13:53
@fazzatti
Copy link
Contributor Author

Hi @petermetz !

It took me a while to make all the adjustments and add the Rust project of the demo contract, but I've managed to complete it. Would you please have a look and review it whenever you are available?

Copy link
Member

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@fazzatti Looking good to me, thank you again for the contribution and the updates! :-)

@petermetz petermetz requested a review from RafaelAPB June 10, 2024 19:43
Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

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

Thanks, looks great ;) I've added a small nitpick but it's optional

Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

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

Oh sorry, reverting approval, I've forgot we've merged a change in openapi definitions yesterday (4a9ed0a)

Please apply the changes you've made in openapi.json to openapi.tpl.json instead (it's in the same folder), then run the npm run codegen - this will create the final openapi.json. In general, all changes should be made to the tpl.json file from now on :)

@fazzatti fazzatti force-pushed the feat-stellar-ledger-connector-run-soroban-transaction branch 2 times, most recently from f10571f to 6526e80 Compare June 15, 2024 20:35
@fazzatti fazzatti requested a review from outSH June 15, 2024 20:48
@fazzatti
Copy link
Contributor Author

Hi @outSH !
Thank you so much for the comments, I made the suggested changes and hope everything is ok now!

Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Member

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@fazzatti Please resolve the merge conflict in the opanpi.tpl.json file! Let me know if you need any help! See my earlier posts on what the new openapi.tpl.json file is if you aren't sure!

@fazzatti fazzatti force-pushed the feat-stellar-ledger-connector-run-soroban-transaction branch 3 times, most recently from 9fcc6a7 to efb6e13 Compare June 24, 2024 16:52
@fazzatti
Copy link
Contributor Author

@petermetz thank you so much! I took a beating from this last update 🤣
While trying to fix the conflict, I ended up causing a big mess in my branch, but after some probing around and digging deeper, I think I've managed to correct everything. 🙏

Please let me know if you notice anything I might've missed, or that requires any additional steps.

Copy link
Member

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@fazzatti No worries, I'm glad it got figured out in the end :-) Please squash the commits together though!

- Add a run soroban transaction endpoint to the Stellar Connector plugin.
- Add a Soroban hellow_world contract to the demo-contract folder.

**Remarks:**

The `runSorobanTransaction` endpoint can be used to make smart contract
invocations on the Soroban platform. The endpoint accepts a flag
called `readOnly` to indicate when the transaction should not alter
ledger state. When `true`, the transaction will only be simulated based
on the current ledger state and provide an up-to-date output without
registering the transaction to the ledger, ensuring no fees are
consumed. When `false`, the transaction will be executed and registered
to the ledger even if it doesn't alter the ledger state, incurring
fees as usual.

More details can be found in the `README.md` file under the connector root directory.

Closes hyperledger#3238

Signed-off-by: Fabricius Zatti <fazzatti@gmail.com>
@fazzatti fazzatti force-pushed the feat-stellar-ledger-connector-run-soroban-transaction branch from b94967c to fe1bc7b Compare June 24, 2024 20:44
@fazzatti fazzatti requested a review from petermetz June 24, 2024 21:33
@fazzatti
Copy link
Contributor Author

@fazzatti No worries, I'm glad it got figured out in the end :-) Please squash the commits together though!

Sorry about that, I completely forgot about not using the update branch button 🤦

Copy link
Member

@petermetz petermetz left a comment

Choose a reason for hiding this comment

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

@fazzatti No worries, thank you again for the contribution(s)! :-)

@petermetz petermetz merged commit 866b7d1 into hyperledger:main Jun 24, 2024
149 of 150 checks passed
@petermetz petermetz deleted the feat-stellar-ledger-connector-run-soroban-transaction branch June 24, 2024 23:32
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.

3 participants