metadata: Exclude field::type_name from metadata validation (#595)

* metadata: Exclude `field::type_name` from metadata validation

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Adjust code-base to rust `1.62.0`

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2022-07-07 12:23:23 +03:00
committed by GitHub
parent c55b7ba3e3
commit b3f6ff1cf8
4 changed files with 8 additions and 12 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ impl TypeDefParameters {
} }
} }
impl<'a> quote::ToTokens for TypeDefParameters { impl quote::ToTokens for TypeDefParameters {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
if !self.params.is_empty() { if !self.params.is_empty() {
let params = &self.params; let params = &self.params;
-3
View File
@@ -72,9 +72,6 @@ fn get_field_hash(
if let Some(name) = field.name() { if let Some(name) = field.name() {
bytes = xor(bytes, hash(name.as_bytes())); bytes = xor(bytes, hash(name.as_bytes()));
} }
if let Some(name) = field.type_name() {
bytes = xor(bytes, hash(name.as_bytes()));
}
bytes bytes
} }
+6 -6
View File
@@ -47,9 +47,9 @@ pub use super::{
/// and is exposed only to be called via the codegen. It may /// and is exposed only to be called via the codegen. It may
/// break between minor releases. /// break between minor releases.
#[doc(hidden)] #[doc(hidden)]
pub async fn subscribe<'a, T: Config, Evs: Decode + 'static>( pub async fn subscribe<T: Config, Evs: Decode + 'static>(
client: &'a Client<T>, client: &Client<T>,
) -> Result<EventSubscription<'a, EventSub<T::Header>, T, Evs>, BasicError> { ) -> Result<EventSubscription<EventSub<T::Header>, T, Evs>, BasicError> {
let block_subscription = client.rpc().subscribe_blocks().await?; let block_subscription = client.rpc().subscribe_blocks().await?;
Ok(EventSubscription::new(client, block_subscription)) Ok(EventSubscription::new(client, block_subscription))
} }
@@ -60,9 +60,9 @@ pub async fn subscribe<'a, T: Config, Evs: Decode + 'static>(
/// and is exposed only to be called via the codegen. It may /// and is exposed only to be called via the codegen. It may
/// break between minor releases. /// break between minor releases.
#[doc(hidden)] #[doc(hidden)]
pub async fn subscribe_finalized<'a, T: Config, Evs: Decode + 'static>( pub async fn subscribe_finalized<T: Config, Evs: Decode + 'static>(
client: &'a Client<T>, client: &Client<T>,
) -> Result<EventSubscription<'a, FinalizedEventSub<'a, T::Header>, T, Evs>, BasicError> { ) -> Result<EventSubscription<FinalizedEventSub<T::Header>, T, Evs>, BasicError> {
// fetch the last finalised block details immediately, so that we'll get // fetch the last finalised block details immediately, so that we'll get
// events for each block after this one. // events for each block after this one.
let last_finalized_block_hash = client.rpc().finalized_head().await?; let last_finalized_block_hash = client.rpc().finalized_head().await?;
@@ -75,8 +75,7 @@ async fn full_metadata_check() {
assert_eq!( assert_eq!(
new_api new_api
.validate_metadata() .validate_metadata()
.err() .expect_err("Validation should fail for incompatible metadata"),
.expect("Validation should fail for incompatible metadata"),
::subxt::MetadataError::IncompatibleMetadata ::subxt::MetadataError::IncompatibleMetadata
); );
} }