Skip to content

subxt-core crate#1466

Merged
jsdw merged 67 commits intomasterfrom
tadeohepperle/subxt-core-3
Mar 27, 2024
Merged

subxt-core crate#1466
jsdw merged 67 commits intomasterfrom
tadeohepperle/subxt-core-3

Conversation

@tadeohepperle
Copy link
Copy Markdown
Contributor

@tadeohepperle tadeohepperle commented Mar 7, 2024

Introduces a subxt-core crate that provides a no_std compatible subset of subxt's functionality.

core/Cargo.toml Outdated
[features]
default = ["std"] # "std"
std = [
"scale-info/std",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why are not all crates that has default-features = false added here?

For instance codec/std is not enabled and many more....

/// Return the provided [`RuntimeVersion`].
fn runtime_version(&self) -> RuntimeVersion;
/// Return the [subxt_core::client::ClientState] (metadata, runtime version and genesis hash).
fn client_state(&self) -> ClientState<T>;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we have this method, then let's give it a default impl too since it's just a concat of a few of the above :)


/// Return the [subxt_core::client::ClientState] (metadata, runtime version and genesis hash).
pub fn client_state(&self) -> ClientState<T> {
let inner = self.inner.read().expect("shouldn't be poisoned");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess even with a default impl we'll want this bit anyay though to avoid multiple locks, but it could be seen as an optimisation anyway, so it's all good :)

@jsdw
Copy link
Copy Markdown
Collaborator

jsdw commented Mar 20, 2024

This is great stuff; left another round of comments but all pretty minor things, and we can thing more about docs etc later :)

@tadeohepperle if you have time to address the small comments and get things compiling then I'm happy to see this merge now!

@@ -31,22 +33,15 @@ pub trait ConstantAddress {
#[derivative(
Clone(bound = ""),
Debug(bound = ""),
Eq(bound = ""),
Ord(bound = ""),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no Ord impl anymore?

/// A static address to a custom value.
#[derive(Derivative)]
#[derivative(
Clone(bound = ""),
Debug(bound = ""),
Eq(bound = ""),
Ord(bound = ""),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here no Ord?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is these changes related to this refactoring? Lots of changes at least

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, there should be a lot of changes, because we use a lot of types from subxt_core now instead of pulling them from subxt. Additionally we use rust prelude types from alloc instead of from std.

Copy link
Copy Markdown
Contributor

@niklasad1 niklasad1 Mar 22, 2024

Choose a reason for hiding this comment

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

I'm pretty slow and don't understand the comment!

I suppose you mean that we don't test that the generated code is no-std?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh this should be removed, we now test that the generated code compiles in no-std.

Copy link
Copy Markdown
Contributor

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

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

awesome, great job.

just some small comments

@tadeohepperle
Copy link
Copy Markdown
Contributor Author

We need another fix in scale-typegen for the ui tests to succeed: paritytech/scale-typegen#23
@jsdw @niklasad1

@jsdw jsdw merged commit a0cb14a into master Mar 27, 2024
@jsdw jsdw deleted the tadeohepperle/subxt-core-3 branch March 27, 2024 08:55
@Polkadot-Forum
Copy link
Copy Markdown

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

https://forum.polkadot.network/t/parity-tech-update-for-march/7226/1

@jsdw jsdw mentioned this pull request May 16, 2024
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.

4 participants