paritytech / zombienet-sdk

ZombieNet SDK
https://paritytech.github.io/zombienet-sdk/zombienet_sdk/
GNU General Public License v3.0
33 stars 10 forks source link

Simplify Zombienet SDK DX #251

Closed ozgunozerk closed 1 month ago

ozgunozerk commented 2 months ago

Is your feature request related to a problem? Please describe.

Current state of zombienet-sdk is feature-rich, but lacks ease of use for many setting that can be hidden for most of the users by utilizing defaults.

Simplifying the devx may increase and improve adoption, popularity, and open-source contribution.

Describe the solution you'd like

What I have in mind is roughly:

let alice = ZombieNode::new("alice");
let bob = ZombieNode::new("bob");

let collator1 = ZombieCollator::new("collator1");
let collator2 = ZombieCollator::new("collator2");

let parachain = ZombieParachain::new().set_id(100).set_collators(collator1, collator2);

let zombienet = Zombienet::new() // also possible to supply a `config` file here by calling `from()` method
        .set_nodes(alice, bob)
        .set_parachains(parachain)
        .spawn();

let alice_client: subxt_client = zombienet.get_client("alice");

/*
    Here, we can use `alice_client` to submit any transaction or query the blockchain,
    any subxt (polkadotjs) functionality is exposed via `alice_client` here
*/

Describe alternatives you've considered

No response

Additional context

We met with @pepoviola and we are on the same page.

We want to preserve the builder and type-state-pattern, to enforce compile time checks and errors for the users.

This feature will not rewrite everything from scratch, but will act as a wrapper on top of the current code. Thus, preserve the safety measures that are already there

ozgunozerk commented 2 months ago

Feel free to assign this issue to me.

I'll submit a draft PR to have the discussion there and keep this issue compact for newcomers.

jmg-duarte commented 1 month ago

On this, I'd re-export all zombienet_* crates with the SDK, instead of depending on them but requiring them to be explicitly added to the project instead.

I keep needing to add more stuff to the Cargo.toml that should just be in the SDK

pepoviola commented 1 month ago

I think we coukd re-export the crates or in this case just create the wrappers as part of the sdk crate itself. Thoughts @ozgunozerk ?

ozgunozerk commented 1 month ago

I don't have any strong preferences, as you guys see fit! @pepoviola I want to start on the implementation, did you have a chance to check out the draft PR for the more elaborate and concrete API design?

ozgunozerk commented 1 month ago

Update: I have something ready, will polish it and submit it soon!

Polkadot-Forum commented 1 month ago

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/milestone-3-status-update-milestone-4-proposal-openzeppelin-x-polkadot-ecosystem-growth/10300/1