diff --git a/subxt/examples/setup_config_custom.rs b/subxt/examples/setup_config_custom.rs index 713145d6dc..0f2ad2e27b 100644 --- a/subxt/examples/setup_config_custom.rs +++ b/subxt/examples/setup_config_custom.rs @@ -2,7 +2,7 @@ use codec::Encode; use subxt::client::OfflineClientT; use subxt::config::{Config, ExtrinsicParams, ExtrinsicParamsEncoder}; -use subxt_core::error::ExtrinsicParamsError; +use subxt_core::ExtrinsicParamsError; use subxt_signer::sr25519::dev; #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")] diff --git a/subxt/examples/setup_config_signed_extension.rs b/subxt/examples/setup_config_signed_extension.rs index a5492ff91c..a48e17570f 100644 --- a/subxt/examples/setup_config_signed_extension.rs +++ b/subxt/examples/setup_config_signed_extension.rs @@ -7,7 +7,7 @@ use subxt::config::{ Config, DefaultExtrinsicParamsBuilder, ExtrinsicParams, ExtrinsicParamsEncoder, }; use subxt_core::config::signed_extensions; -use subxt_core::error::ExtrinsicParamsError; +use subxt_core::ExtrinsicParamsError; use subxt_signer::sr25519::dev; #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")] diff --git a/testing/no-std-tests/Cargo.lock b/testing/no-std-tests/Cargo.lock index b13c83f097..f000fd232a 100644 --- a/testing/no-std-tests/Cargo.lock +++ b/testing/no-std-tests/Cargo.lock @@ -167,9 +167,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -277,9 +277,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" [[package]] name = "fixed-hash" diff --git a/testing/no-std-tests/Cargo.toml b/testing/no-std-tests/Cargo.toml index 2d6da33488..4f29b68aaf 100644 --- a/testing/no-std-tests/Cargo.toml +++ b/testing/no-std-tests/Cargo.toml @@ -7,8 +7,8 @@ resolver = "2" [dependencies] subxt-metadata = { path = "../../metadata", default-features = false } -subxt-core = { path = "../../core", default-features = false } subxt-signer = { path = "../../signer", default-features = false, features = ["sr25519", "ecdsa", "subxt"] } +subxt-core = { path = "../../core", default-features = false } codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false, features = ["derive"] } libc = { version = "0.2", default-features = false } libc_alloc = { version = "1.0.6" } diff --git a/testing/no-std-tests/README.md b/testing/no-std-tests/README.md new file mode 100644 index 0000000000..b6e108e054 --- /dev/null +++ b/testing/no-std-tests/README.md @@ -0,0 +1,11 @@ +# no_std tests + +This crate makes sure some of the subxt-* crates work in a no-std environment. + +We would like it to run in a no-std environment. You can try any of the following to get it to compile: +``` +cargo run +cargo build --target thumbv7em-none-eabi +cargo build --target aarch64-unknown-none +``` +Currently it does not compile due to linker errors and I have no idea how to resovle these. \ No newline at end of file diff --git a/testing/no-std-tests/src/main.rs b/testing/no-std-tests/src/main.rs index 7a7b411479..ae1860f311 100644 --- a/testing/no-std-tests/src/main.rs +++ b/testing/no-std-tests/src/main.rs @@ -9,7 +9,7 @@ #[start] fn start(_argc: isize, _argv: *const *const u8) -> isize { - compile_test(); + test(); 0 } @@ -19,7 +19,9 @@ pub extern "C" fn rust_eh_personality() {} #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { - loop {} + unsafe { + libc::abort(); + } } use libc_alloc::LibcAlloc; @@ -33,27 +35,30 @@ extern crate alloc; /// Including code here makes sure it is not pruned. /// We want all code included to compile fine for the `thumbv7em-none-eabi` target. -fn compile_test() { - subxt_metadata_compiles(); -} +fn test() { + // ///////////////////////////////////////////////////////////////////////////// + // subxt-metadata + // ///////////////////////////////////////////////////////////////////////////// -fn subxt_metadata_compiles() { use codec::Decode; let bytes: alloc::vec::Vec = alloc::vec![0, 1, 2, 3, 4]; subxt_metadata::Metadata::decode(&mut &bytes[..]).expect_err("invalid byte sequence"); const METADATA: &[u8] = include_bytes!("../../../artifacts/polkadot_metadata_small.scale"); subxt_metadata::Metadata::decode(&mut &METADATA[..]).expect("should be valid metadata"); -} -fn subxt_signer_test() { - use subxt_signer::{ SecretUri, ecdsa::Keypair }; + // ///////////////////////////////////////////////////////////////////////////// + // subxt-signer + // ///////////////////////////////////////////////////////////////////////////// + use core::str::FromStr; + use subxt_signer::{ecdsa::Keypair, SecretUri}; let uri = SecretUri::from_str("//Alice").unwrap(); - let keypair = Keypair::from_uri(&uri).unwrap(); -} + let _keypair = Keypair::from_uri(&uri).unwrap(); -fn subxt_core_test() { - let _ = subxt_core::utils::Era::Immortal; -} + // ///////////////////////////////////////////////////////////////////////////// + // subxt-core + // ///////////////////////////////////////////////////////////////////////////// + let _era = subxt_core::utils::Era::Immortal; +}