-
Notifications
You must be signed in to change notification settings - Fork 289
[WIP] Subxt-Core Crate #1411
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
Closed
Closed
[WIP] Subxt-Core Crate #1411
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
a262766
no-std tests and porting of subxt-metadata
tadeohepperle 8aa4bec
Merge branch 'master' into tadeohepperle/subxt-metadata-no-std
tadeohepperle 55cfb23
update pipeline
tadeohepperle 1b4e371
fix generate custom metadata test
tadeohepperle d679e95
fix cargo run command
tadeohepperle 7954815
adjust pipeline
tadeohepperle fbee16d
Merge branch 'master' into tadeohepperle/subxt-metadata-no-std
tadeohepperle a3ec38f
init of subxt-core crate
tadeohepperle 4512ad7
subxt-core compiles to no std again
tadeohepperle 2e66b48
subxt compiles with new dependency features
tadeohepperle 7b2cfdc
subxt: use utils from core
tadeohepperle aed00e5
start porting dynamic value stuff
tadeohepperle 97aad71
add storage address and custom error type to core crate
tadeohepperle 7aa6989
remove prelude from subxt-metadata
tadeohepperle addc4c8
Merge branch 'master' into tadeohepperle/subxt-metadata-no-std
tadeohepperle 87200b4
revert autoformatting of Cargo.toml
tadeohepperle 57743c3
remove alloc::format! again, still causes linker errors
tadeohepperle 408f81e
Merge branch 'master' into tadeohepperle/subxt-metadata-no-std
tadeohepperle 6236c49
Merge branch 'tadeohepperle/subxt-metadata-no-std' into tadeohepperle…
tadeohepperle e427529
remove prelude from core, use alloc directly
tadeohepperle e855aac
constants and storage entries
tadeohepperle 930f2c4
custom values and runtime apis
tadeohepperle 14b21ab
port subxt-signer to no-std (such a pain)
tadeohepperle 4e2d3fd
core integration into subxt, except for examples
tadeohepperle fce85c4
start fixing examples and cleaning up interface
tadeohepperle e5ee971
discover linker errors for subxt-signer critical section of once_cell
tadeohepperle bc6cd9b
fmt for whole workspace
tadeohepperle f41f090
add no-std-build for thumbv7em-none-eabi target
tadeohepperle 32f69dd
Merge branch 'tadeohepperle/subxt-metadata-no-std' into tadeohepperle…
tadeohepperle 2b38a0f
try compiling with different methods, no success
tadeohepperle ce17d82
remove std feature flag
tadeohepperle 5d6e0d5
Merge branch 'master' into tadeohepperle/subxt-metadata-no-std
tadeohepperle cb0d35d
Merge branch 'master' into tadeohepperle/subxt-metadata-no-std
tadeohepperle 64987fe
adjust subxt signer static once locks
tadeohepperle d447f7c
remove libc and add small readme with test instructions
tadeohepperle a0a79c4
Merge branch 'tadeohepperle/subxt-metadata-no-std' into tadeohepperle…
tadeohepperle cc33870
remove unicode normalization and std references
tadeohepperle b86b1ea
subxt signer linker errors but core compiles
tadeohepperle 1fe8ec3
[Fix] Auto-generated PR: delete polkadot binaries from working direct…
tadeohepperle db00212
Add missing codegen mod in integration tests (#1418)
tadeohepperle fda9a5f
Subxt Metadata: `#[no_std]` compatibility (#1401)
tadeohepperle ac3c7d7
fix examples with core crate
tadeohepperle e527687
formatting
tadeohepperle eeca8f8
Merge branch 'master' into tadeohepperle/subxt-core-2
tadeohepperle 6147ac9
fix unused deps
tadeohepperle fbf2cc9
fix doc tests and docs
tadeohepperle aae7636
fmt
tadeohepperle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| [package] | ||
| name = "subxt-core" | ||
| version.workspace = true | ||
| authors.workspace = true | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| publish = true | ||
|
|
||
| license.workspace = true | ||
| readme = "README.md" | ||
| repository.workspace = true | ||
| documentation.workspace = true | ||
| homepage.workspace = true | ||
| description = "Sign extrinsics to be submitted by Subxt" | ||
| keywords = ["parity", "subxt", "extrinsic", "no-std"] | ||
|
|
||
| [features] | ||
| default = ["std"] | ||
| std = ["scale-info/std", "scale-value/std", "scale-bits/std", "scale-decode/std", "scale-encode/std", "frame-metadata/std", "subxt-metadata/std"] | ||
| substrate-compat = ["sp-core", "sp-runtime"] | ||
|
|
||
| [dependencies] | ||
|
|
||
| codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive"] } | ||
| scale-info = { workspace = true, default-features = false, features = ["bit-vec"] } | ||
| scale-value = { workspace = true, default-features = false } | ||
| scale-bits = { workspace = true, default-features = false } | ||
| scale-decode = { workspace = true, default-features = false, features = ["derive", "primitive-types"] } | ||
| scale-encode = { workspace = true, default-features = false, features = ["derive", "primitive-types", "bits"] } | ||
| frame-metadata = { workspace = true, default-features = false } | ||
| subxt-metadata = { workspace = true, default-features = false } | ||
| derivative = { workspace = true, features = ["use_core"] } | ||
| derive_more = { workspace = true } | ||
| hex = { workspace = true, default-features = false, features = ["alloc"] } | ||
| serde = { workspace = true, default-features = false, features = ["derive"] } | ||
| serde_json = { workspace = true, default-features = false, features = ["raw_value", "alloc"] } | ||
|
|
||
| # For ss58 encoding AccountId32 to serialize them properly: | ||
| base58 = { workspace = true } | ||
| blake2 = { workspace = true } | ||
|
|
||
| # Provides some deserialization, types like U256/H256 and hashing impls like twox/blake256: | ||
| impl-serde = { workspace = true, default-features = false } | ||
| primitive-types = { workspace = true, default-features = false, features = ["codec", "serde_no_std", "scale-info"] } | ||
| sp-core-hashing = { workspace = true } | ||
|
|
||
| # Included if the "substrate-compat" feature is enabled. | ||
| sp-core = { workspace = true, optional = true } | ||
| sp-runtime = { workspace = true, optional = true } | ||
| either = { workspace = true } | ||
|
|
||
| [dev-dependencies] | ||
| bitvec = { workspace = true } | ||
| codec = { workspace = true, features = ["derive", "bit-vec"] } | ||
| sp-core = { workspace = true } | ||
| sp-keyring = { workspace = true } | ||
| sp-runtime = { workspace = true } | ||
|
|
||
|
|
||
| [package.metadata.docs.rs] | ||
| defalt-features = true | ||
| rustdoc-args = ["--cfg", "docsrs"] | ||
|
|
||
| [package.metadata.playground] | ||
| defalt-features = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Subxt-Core | ||
|
|
||
| This library provides core functionality using in `subxt` and `subxt-signer`. It should be no-std compatible. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| use derivative::Derivative; | ||
|
|
||
| use crate::{config::Config, metadata::Metadata}; | ||
|
|
||
| /// the base for a client should be: | ||
| /// - runtime version | ||
| /// - genesis hash | ||
| /// - metadata | ||
|
|
||
| #[derive(Derivative)] | ||
| #[derivative(Debug(bound = ""), Clone(bound = ""))] | ||
| pub struct ClientBase<C: Config> { | ||
| pub genesis_hash: C::Hash, | ||
| pub runtime_version: RuntimeVersion, | ||
| pub metadata: Metadata, | ||
| marker: core::marker::PhantomData<C>, | ||
| } | ||
|
|
||
| impl<C: Config> ClientBase<C> { | ||
| pub fn new(genesis_hash: C::Hash, runtime_version: RuntimeVersion, metadata: Metadata) -> Self { | ||
| Self { | ||
| genesis_hash, | ||
| runtime_version, | ||
| metadata, | ||
| marker: core::marker::PhantomData, | ||
| } | ||
| } | ||
|
|
||
| pub fn metadata(&self) -> Metadata { | ||
| self.metadata.clone() | ||
jsdw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| pub fn runtime_version(&self) -> RuntimeVersion { | ||
| self.runtime_version | ||
| } | ||
|
|
||
| pub fn genesis_hash(&self) -> C::Hash { | ||
| self.genesis_hash | ||
| } | ||
| } | ||
|
|
||
| /// Runtime version information needed to submit transactions. | ||
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
| pub struct RuntimeVersion { | ||
| /// Version of the runtime specification. A full-node will not attempt to use its native | ||
| /// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, | ||
| /// `spec_version` and `authoring_version` are the same between Wasm and native. | ||
| pub spec_version: u32, | ||
|
|
||
| /// All existing dispatches are fully compatible when this number doesn't change. If this | ||
| /// number changes, then `spec_version` must change, also. | ||
| /// | ||
| /// This number must change when an existing dispatchable (module ID, dispatch ID) is changed, | ||
| /// either through an alteration in its user-level semantics, a parameter | ||
| /// added/removed/changed, a dispatchable being removed, a module being removed, or a | ||
| /// dispatchable/module changing its index. | ||
| /// | ||
| /// It need *not* change when a new module is added or when a dispatchable is added. | ||
| pub transaction_version: u32, | ||
| } | ||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now we should add a warning here and in the lib docs that this is not stable may still change significantly between releases, so better to rely on
subxtwhere possible: there's a lot to look at and think about with this new crate, but at the same time it'd be good to feel like we can release it now and iterate on it without worrying too much about breaking things :)