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

Support embedded full/light node clients. #91

Merged
merged 7 commits into from
Jun 15, 2020

Conversation

dvc94ch
Copy link
Contributor

@dvc94ch dvc94ch commented Apr 18, 2020

This let's the ClientBuilder specify a jsonrpsee::Client and implements a jsonrpsee::ClientTransport that wraps a substrate light client.

TODO:

Closes #49

@dvc94ch
Copy link
Contributor Author

dvc94ch commented May 7, 2020

any ideas how to write tests for this? node-cli isn't published to crates.io, maybe we need a test-node here. might also be useful for testing in the future?

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Jun 9, 2020

@ascjones can you please review? While the light client still doesn't work, it now also supports spawning full nodes, which means we can start working on removing the #[ignored] from our tests.

@dvc94ch dvc94ch force-pushed the lightclient branch 2 times, most recently from db612aa to c9b942d Compare June 9, 2020 16:30
@dvc94ch
Copy link
Contributor Author

dvc94ch commented Jun 9, 2020

Enabled all non subxt tests to use the node-template from git. They are no longer #[ignore]

@ascjones
Copy link
Contributor

ascjones commented Jun 9, 2020

I'll have a look tomorrow

Copy link
Contributor

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

Looks good, though I'd like a bit more documentation describing what is going on i.e. embedding a full/light node into the client itself. And whether it is just intended for testing etc. Perhaps a short section in the readme would be good.

Also in the future we could define our own local test runtime (as you have previously suggested) which includes contracts.

One downside here is that running the tests will now take considerably longer (CI time has more than doubled to 25 minutes), but at least the tests are running now on CI.

client/Cargo.toml Outdated Show resolved Hide resolved
client/Cargo.toml Outdated Show resolved Hide resolved
client/Cargo.toml Show resolved Hide resolved
client/src/lib.rs Show resolved Hide resolved
client/src/lib.rs Outdated Show resolved Hide resolved
@dvc94ch
Copy link
Contributor Author

dvc94ch commented Jun 11, 2020

@ascjones added a README section

Copy link
Contributor

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

I'm hesitant to merge this at the moment because of the massive increase in compile time, although it is massively useful because it allows tests to be run on CI (and I like the idea of the embedded light client).

I can be persuaded of the benefits, but it does conflict with the idea of keeping this library (relatively) lightweight.


[patch.crates-io]
sc-network = { git = "https://github.com/paritytech/substrate" }
sc-service = { git = "https://github.com/paritytech/substrate" }
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these patches for? Something not yet included in rc3? It might prevent publishing the main crate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that node template isn't published, but it's required for the tests. So this makes sure that when it's checked out locally it uses the same versions as the template. I was hoping this trick would allow publish to crates.io

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Jun 12, 2020

The library still is light weight, only compiling the tests takes longer, if you add it as a dep, without the light client enabled it shouldn't increase compile times

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Jun 12, 2020

I'd love this to be the defacto standard way of building substrate based applications. We're using it heavily and once your metadata work is finished, I think it'll be on track to be that. We're building tools like dart bindgen that will allow us to rapidly create flutter ui's using subxt.

Copy link
Contributor

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM

@ascjones ascjones changed the title Support for light clients. Support embedded full/light node clients. Jun 15, 2020
@ascjones ascjones merged commit 21d07c6 into paritytech:master Jun 15, 2020
@ascjones ascjones mentioned this pull request Jun 25, 2020
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.

Setup CI
2 participants