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

E2E testing tools for Soroban contracts #34

Closed
eloylp opened this issue Aug 1, 2023 · 12 comments
Closed

E2E testing tools for Soroban contracts #34

eloylp opened this issue Aug 1, 2023 · 12 comments
Assignees
Labels
Milestone

Comments

@eloylp
Copy link
Member

eloylp commented Aug 1, 2023

Context

During the development of the first smart contracts, we manually tested them in Futurenet

As we can observe in the above manual tests, the CLI code is able to interact with Futurnet. That could provide some inspiration.

Futurenet is currently the only environment that runs the Soroban smart contract platform. Its in continuous change. Thats also an extra motivation for having e2e tests.

Goals

To be able to write a fairly efficient e2e tests suite that works in Futurenet , capable of running in a CI.

  • First Investigate the state of the art of e2e testing tools for Soroban ecosystem.
  • Progressively create the tools while we develop the smart contracts, by refining abstractions and use cases.
  • To keep an eye in the development process regarding this research idea and log on this issue all the thoughts, abstractions, experiments, lets use this use as communication hub.
@eloylp eloylp added the research label Aug 1, 2023
@eloylp
Copy link
Member Author

eloylp commented Aug 1, 2023

On my mind, happy path, it would be great to have a set of Rust declarative macros to easen this kind of tests 💭

@mariopil
Copy link
Member

mariopil commented Aug 2, 2023

When I was in Hooks I've developed a test framework for Hooks contracts that was using standalone XRP server. Maybe it could be useful here.
https://github.com/eqlabs/hooks-test-framework

@eloylp
Copy link
Member Author

eloylp commented Aug 2, 2023

When I was in Hooks I've developed a test framework for Hooks contracts that was using standalone XRP server. Maybe it could be useful here. https://github.com/eqlabs/hooks-test-framework

@mariopil i cannot access such repo 😢 probably permissions. But from what you comment, looks thats the idea :D

@mariopil
Copy link
Member

mariopil commented Aug 2, 2023

Try now - I've gave you and @geofmureithi both read permissions.

@mariopil
Copy link
Member

mariopil commented Aug 2, 2023

Oh, seems I can only add one of you to the repo...:
You must purchase at least one more seat to add this user as a collaborator. [Add seat](https://github.com/organizations/eqlabs/settings/billing/seats?seats=1)

@eloylp
Copy link
Member Author

eloylp commented Aug 3, 2023

When I was in Hooks I've developed a test framework for Hooks contracts that was using standalone XRP server. Maybe it could be useful here. https://github.com/eqlabs/hooks-test-framework

I like the idea ! On my mind that would be like having a sofisticated table driven test, in which adding new cases is very easy. That would reduce a lot all the boilerplate code (testing infrastructure related code), which would be practically the same on each test. Leaving the developer to only care about the logical part of the test. Also, the testing code infrastructure could get improved and versioned. So my vote on looking into that 👍

Said that, i also think we are in a very early stage. I think would be good to check the state of the art regarding as we commented :)

We are going to build 3 new contracts at #35 , i would start organically from there, gaining experiences with low level "rust ways" of encapsulating this code infrastructure, that would be the building blocks for such a testing framework IMO. We could even leave open such low level building blocks for the community to build on top of them :D . Please feel free to use this issue as communication hub for sharing your experiences in code.

So yeah, IMO lets organically build the low level tools heading ⛵ to the testing framework 🚀

@geofmureithi
Copy link
Contributor

Soroban comes with alot of commands inbuilt. We can steal ideas from cargo make:

[tasks.init]
command = "init"
args = ["addr", "--", "MYPRIVATEKEY"]

[tasks.create_proposal]
command = "create_proposal"
args = ["id", "1"]

[tasks.vote]
command = "vote"
args = ["param1", "param2"]
dependencies = ["create_proposal"]

[tasks.flow]
dependencies = [
    "init",
    "create_proposal",
    "vote"
]

@geofmureithi
Copy link
Contributor

Additionally, soroban-cli has a run_in_sandbox method that simulates an rpc server.
https://github.com/stellar/soroban-tools/blob/13ee0d59fd77d06b983e37b42d6ed418acbb1f2c/cmd/soroban-cli/src/commands/contract/deploy.rs#L132

@mariopil mariopil self-assigned this Aug 9, 2023
@mariopil mariopil added this to the Milestone 1 milestone Aug 9, 2023
@eloylp
Copy link
Member Author

eloylp commented Aug 24, 2023

@mariopil is this of interest for parsing transactions ? https://docs.rs/stellar-xdr/0.0.17/stellar_xdr

@mariopil
Copy link
Member

Rather no currently. I'm using js as it seems that the js SDKs are most up to date.

@eloylp
Copy link
Member Author

eloylp commented Aug 24, 2023

Rather no currently. I'm using js as it seems that the js SDKs are most up to date.

Yeah, thats true. In the other hand i feel we could be missing an opportunity to contribute to Soroban maybe ? Sorry i probably do not have enough context. What are the main blockers you have found for not doing it in Rust ? Apart everything is pre-release 😁

@mariopil
Copy link
Member

I could only parse properly xdr results using the js SDK. And not even the StellarSDK, but had to use SorobanClient one. The tool still uses soroban client for most of the tasks (deploy contract, invoke methods, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants