mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Merge branch 'master' into jsdw-ensure-unique-types-tidyup
This commit is contained in:
+8
-10
@@ -312,9 +312,8 @@ fn subxt_type_gen_settings(
|
||||
crate_path: &syn::Path,
|
||||
should_gen_docs: bool,
|
||||
) -> TypeGeneratorSettings {
|
||||
// If we're using codec::Encode or codec::Decode derives, then we want to
|
||||
// output #[codec(index = N)] and #[codec(compact)] attrs, else we don't.
|
||||
let insert_codec_attributes = derives.default_derives().derives().iter().any(|path| {
|
||||
// Are we using codec::Encode or codec::Decode derives?
|
||||
let are_codec_derives_used = derives.default_derives().derives().iter().any(|path| {
|
||||
let mut segments_backwards = path.segments.iter().rev();
|
||||
let ident = segments_backwards.next();
|
||||
let module = segments_backwards.next();
|
||||
@@ -325,12 +324,9 @@ fn subxt_type_gen_settings(
|
||||
is_ident_match && is_module_match
|
||||
});
|
||||
|
||||
// If we're inserting the codec attributes, we also should use `CompactAs` where necessary.
|
||||
let compact_as_type_path = if insert_codec_attributes {
|
||||
Some(parse_quote!(#crate_path::ext::codec::CompactAs))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
// If we're inserting the codec derives, we also should use `CompactAs` where necessary.
|
||||
let compact_as_type_path =
|
||||
are_codec_derives_used.then(|| parse_quote!(#crate_path::ext::codec::CompactAs));
|
||||
|
||||
TypeGeneratorSettings {
|
||||
types_mod_ident: parse_quote!(runtime_types),
|
||||
@@ -340,8 +336,10 @@ fn subxt_type_gen_settings(
|
||||
decoded_bits_type_path: Some(parse_quote!(#crate_path::utils::bits::DecodedBits)),
|
||||
compact_as_type_path,
|
||||
compact_type_path: Some(parse_quote!(#crate_path::ext::codec::Compact)),
|
||||
insert_codec_attributes,
|
||||
alloc_crate_path: AllocCratePath::Custom(parse_quote!(#crate_path::alloc)),
|
||||
// Note: even when we don't use codec::Encode and codec::Decode, we need to keep #[codec(...)]
|
||||
// attributes because `#[codec(skip)]` is still used/important with `EncodeAsType` and `DecodeAsType`.
|
||||
insert_codec_attributes: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
//!
|
||||
//! ### Implementing [`crate::config::ExtrinsicParams`] from scratch
|
||||
//!
|
||||
//! Alternately, you are free to implement [`crate::config::ExtrinsicParams`] entirely from scratch if you know exactly what "extra" and`
|
||||
//! Alternately, you are free to implement [`crate::config::ExtrinsicParams`] entirely from scratch if you know exactly what "extra" and
|
||||
//! "additional" data your node needs and would prefer to craft your own interface.
|
||||
//!
|
||||
//! Let's see what this looks like (this config won't work on any real node):
|
||||
|
||||
@@ -123,7 +123,7 @@ impl SubstrateNodeBuilder {
|
||||
) -> Result<Child, std::io::Error> {
|
||||
let mut cmd = Command::new(binary_path);
|
||||
|
||||
cmd.env("RUST_LOG", "info,libp2p_tcp=debug")
|
||||
cmd.env("RUST_LOG", "info,libp2p_tcp=debug,litep2p::tcp=debug")
|
||||
.stdout(process::Stdio::piped())
|
||||
.stderr(process::Stdio::piped())
|
||||
.arg("--dev")
|
||||
@@ -295,6 +295,14 @@ fn try_find_substrate_port_from_output(r: impl Read + Send + 'static) -> Substra
|
||||
.rsplit_once("New listen address: /ip4/127.0.0.1/tcp/")
|
||||
// slightly newer message:
|
||||
.or_else(|| line.rsplit_once("New listen address address=/ip4/127.0.0.1/tcp/"))
|
||||
// Newest message using the litep2p backend:
|
||||
.or_else(|| {
|
||||
// The line looks like:
|
||||
// `start tcp transport listen_addresses=["/ip6/::/tcp/30333", "/ip4/0.0.0.0/tcp/30333"]`
|
||||
// we'll split once to find the line itself and then again to find the ipv4 port.
|
||||
line.rsplit_once("start tcp transport listen_addresses=")
|
||||
.and_then(|(_, after)| after.split_once("/ip4/0.0.0.0/tcp/"))
|
||||
})
|
||||
.map(|(_, address_str)| address_str);
|
||||
|
||||
if let Some(line_port) = p2p_port_line {
|
||||
|
||||
Reference in New Issue
Block a user