Skip to content

Commit

Permalink
metadata: Exclude field::type_name from metadata validation (#595)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
lexnv committed Jul 7, 2022
1 parent c55b7ba commit b3f6ff1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion codegen/src/types/type_def_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
if !self.params.is_empty() {
let params = &self.params;
Expand Down
3 changes: 0 additions & 3 deletions metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ fn get_field_hash(
if let Some(name) = field.name() {
bytes = xor(bytes, hash(name.as_bytes()));
}
if let Some(name) = field.type_name() {
bytes = xor(bytes, hash(name.as_bytes()));
}

bytes
}
Expand Down
12 changes: 6 additions & 6 deletions subxt/src/events/event_subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ pub use super::{
/// and is exposed only to be called via the codegen. It may
/// break between minor releases.
#[doc(hidden)]
pub async fn subscribe<'a, T: Config, Evs: Decode + 'static>(
client: &'a Client<T>,
) -> Result<EventSubscription<'a, EventSub<T::Header>, T, Evs>, BasicError> {
pub async fn subscribe<T: Config, Evs: Decode + 'static>(
client: &Client<T>,
) -> Result<EventSubscription<EventSub<T::Header>, T, Evs>, BasicError> {
let block_subscription = client.rpc().subscribe_blocks().await?;
Ok(EventSubscription::new(client, block_subscription))
}
Expand All @@ -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
/// break between minor releases.
#[doc(hidden)]
pub async fn subscribe_finalized<'a, T: Config, Evs: Decode + 'static>(
client: &'a Client<T>,
) -> Result<EventSubscription<'a, FinalizedEventSub<'a, T::Header>, T, Evs>, BasicError> {
pub async fn subscribe_finalized<T: Config, Evs: Decode + 'static>(
client: &Client<T>,
) -> Result<EventSubscription<FinalizedEventSub<T::Header>, T, Evs>, BasicError> {
// fetch the last finalised block details immediately, so that we'll get
// events for each block after this one.
let last_finalized_block_hash = client.rpc().finalized_head().await?;
Expand Down
3 changes: 1 addition & 2 deletions testing/integration-tests/src/metadata/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ async fn full_metadata_check() {
assert_eq!(
new_api
.validate_metadata()
.err()
.expect("Validation should fail for incompatible metadata"),
.expect_err("Validation should fail for incompatible metadata"),
::subxt::MetadataError::IncompatibleMetadata
);
}
Expand Down

0 comments on commit b3f6ff1

Please sign in to comment.