Skip to content

Commit

Permalink
Merge pull request #35 from Alzymologist/more-signature-detectors
Browse files Browse the repository at this point in the history
feat: detect multisignature as signature
  • Loading branch information
varovainen authored Oct 28, 2024
2 parents b32ba7a + 8ea5244 commit 93a818c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/fill_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ use substrate_parser::{
decoding_sci::{find_bit_order_ty, husk_type, FoundBitOrder, ResolvedTy, Ty},
error::{ExtensionsError, RegistryError, RegistryInternalError},
propagated::{Checker, Propagated, SpecialtySet},
special_indicators::{SpecialtyH256, SpecialtyTypeHinted, SpecialtyUnsignedInteger},
special_indicators::{
SignatureIndicator, SpecialtyH256, SpecialtyTypeHinted, SpecialtyUnsignedInteger,
},
traits::ResolveType,
};

Expand Down Expand Up @@ -657,12 +659,21 @@ impl TransactionToFill {
let registry = metadata.types();
for (i, variant) in variant_selector.available_variants.iter().enumerate() {
if variant.fields.len() == 1 {
let ty = registry.resolve_ty(variant.fields[0].ty.id, ext_memory)?;
if let SpecialtyTypeHinted::SignatureSr25519 =
SpecialtyTypeHinted::from_type(&ty)
{
if let SignatureIndicator::Sr25519 = SignatureIndicator::from_field::<E, M>(
&variant.fields[0],
ext_memory,
&registry,
) {
found_index = Some(i);
break;
} else {
let ty = registry.resolve_ty(variant.fields[0].ty.id, ext_memory)?;
if let SpecialtyTypeHinted::SignatureSr25519 =
SpecialtyTypeHinted::from_type(&ty)
{
found_index = Some(i);
break;
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/storage_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::finalize::{Finalize, TypeContent};
use crate::traits::{AsFillMetadata, AsPalletMetadata};

#[derive(Clone, Debug)]
#[allow(clippy::large_enum_variant)]
pub enum EntrySelector {
Empty,
Functional(EntrySelectorFunctional),
Expand Down Expand Up @@ -140,6 +141,7 @@ pub struct StorageEntry {
}

#[derive(Clone, Debug)]
#[allow(clippy::large_enum_variant)]
pub enum StorageEntryTypeToFill {
Plain(UntrackedSymbol<TypeId>),
Map {
Expand All @@ -150,6 +152,7 @@ pub enum StorageEntryTypeToFill {
}

#[derive(Clone, Debug)]
#[allow(clippy::large_enum_variant)]
pub enum StorageSelector {
Empty,
Functional(StorageSelectorFunctional),
Expand Down
1 change: 1 addition & 0 deletions src/try_fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl UnsignedToFill {
UnsignedToFill::U128(ref mut old) => unsigned!(U128, old, source),
}
}
#[allow(irrefutable_let_patterns)]
pub fn upd_from_rpc_u32(&mut self, source: u32) {
match self {
UnsignedToFill::U8(ref mut old) => rpc_u32_fit!(u8, old, source),
Expand Down

0 comments on commit 93a818c

Please sign in to comment.