From c2097aa2e3280412001e4f242cb6b2ed06c0d7f7 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 13 Dec 2019 17:20:41 +0000 Subject: [PATCH] Ignore PhantomData primitives, they are 0 (#53) --- src/events.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/events.rs b/src/events.rs index 984f0a27d5..b8c7a7df84 100644 --- a/src/events.rs +++ b/src/events.rs @@ -127,7 +127,6 @@ impl TryFrom for EventsDecoder { "DispatchError", "Result<(), DispatchError>", "OpaqueTimeSlot", - "rstd::marker::PhantomData<(AccountId, Event)>", // FIXME: determine type size for the following if necessary/possible "IdentificationTuple", "AuthorityList", @@ -163,6 +162,7 @@ impl EventsDecoder { for primitive in arg.primitives() { if !self.type_sizes.contains_key(&primitive) && !ignore_set.contains(primitive.as_str()) + && !primitive.contains("PhantomData") { missing.insert(primitive); } @@ -194,6 +194,10 @@ impl EventsDecoder { } EventArg::Tuple(args) => self.decode_raw_bytes(args, input, output)?, EventArg::Primitive(name) => { + if name.contains("PhantomData") { + // PhantomData is size 0 + return Ok(()) + } if let Some(size) = self.type_sizes.get(name) { let mut buf = vec![0; *size]; input.read(&mut buf)?;