git.delta.rocks / unique-network / refs/commits / e6b665a657b2

difftreelog

fix PR

Trubnikov Sergey2022-12-22parent: #a22e53f.patch.diff
in: master

10 files changed

modifiedcrates/evm-coder/procedural/src/abi_derive/derive_enum.rsdiffbeforeafterboth
--- a/crates/evm-coder/procedural/src/abi_derive/derive_enum.rs
+++ b/crates/evm-coder/procedural/src/abi_derive/derive_enum.rs
@@ -47,11 +47,10 @@
 	)
 }
 
-pub fn impl_enum_abi_type(name: &syn::Ident, option_count: usize) -> proc_macro2::TokenStream {
+pub fn impl_enum_abi_type(name: &syn::Ident) -> proc_macro2::TokenStream {
 	quote! {
 		impl ::evm_coder::abi::AbiType for #name {
 			const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <u8 as ::evm_coder::abi::AbiType>::SIGNATURE;
-			const FIELDS_COUNT: usize = #option_count;
 
 			fn is_dynamic() -> bool {
 				<u8 as ::evm_coder::abi::AbiType>::is_dynamic()
modifiedcrates/evm-coder/procedural/src/abi_derive/derive_struct.rsdiffbeforeafterboth
before · crates/evm-coder/procedural/src/abi_derive/derive_struct.rs
1use super::extract_docs;2use quote::quote;34pub fn tuple_type<'a>(5	field_types: impl Iterator<Item = &'a syn::Type> + Clone,6) -> proc_macro2::TokenStream {7	let field_types = field_types.map(|ty| quote!(#ty,));8	quote! {(#(#field_types)*)}9}1011pub fn tuple_ref_type<'a>(12	field_types: impl Iterator<Item = &'a syn::Type> + Clone,13) -> proc_macro2::TokenStream {14	let field_types = field_types.map(|ty| quote!(&#ty,));15	quote! {(#(#field_types)*)}16}1718pub fn tuple_data_as_ref(19	is_named_fields: bool,20	field_names: impl Iterator<Item = syn::Ident> + Clone,21) -> proc_macro2::TokenStream {22	let field_names = field_names.enumerate().map(|(i, field)| {23		if is_named_fields {24			quote!(&self.#field,)25		} else {26			let field = proc_macro2::Literal::usize_unsuffixed(i);27			quote!(&self.#field,)28		}29	});30	quote! {(#(#field_names)*)}31}3233pub fn tuple_names(34	is_named_fields: bool,35	field_names: impl Iterator<Item = syn::Ident> + Clone,36) -> proc_macro2::TokenStream {37	let field_names = field_names.enumerate().map(|(i, field)| {38		if is_named_fields {39			quote!(#field,)40		} else {41			let field = proc_macro2::Ident::new(42				format!("field{}", i).as_str(),43				proc_macro2::Span::call_site(),44			);45			quote!(#field,)46		}47	});48	quote! {(#(#field_names)*)}49}5051pub fn struct_from_tuple(52	name: &syn::Ident,53	is_named_fields: bool,54	field_names: impl Iterator<Item = syn::Ident> + Clone,55) -> proc_macro2::TokenStream {56	let field_names = field_names.enumerate().map(|(i, field)| {57		if is_named_fields {58			quote!(#field,)59		} else {60			let field = proc_macro2::Ident::new(61				format!("field{}", i).as_str(),62				proc_macro2::Span::call_site(),63			);64			quote!(#field,)65		}66	});6768	if is_named_fields {69		quote! {#name {#(#field_names)*}}70	} else {71		quote! {#name (#(#field_names)*)}72	}73}7475pub fn map_field_to_name(field: (usize, &syn::Field)) -> syn::Ident {76	match field.1.ident.as_ref() {77		Some(name) => name.clone(),78		None => {79			let mut name = "field".to_string();80			name.push_str(field.0.to_string().as_str());81			syn::Ident::new(name.as_str(), proc_macro2::Span::call_site())82		}83	}84}8586pub fn map_field_to_type(field: &syn::Field) -> &syn::Type {87	&field.ty88}8990pub fn map_field_to_doc(field: &syn::Field) -> syn::Result<Vec<proc_macro2::TokenStream>> {91	extract_docs(&field.attrs, true)92}9394pub fn impl_can_be_placed_in_vec(ident: &syn::Ident) -> proc_macro2::TokenStream {95	quote! {96		impl ::evm_coder::sealed::CanBePlacedInVec for #ident {}97	}98}99100pub fn impl_struct_abi_type(101	name: &syn::Ident,102	tuple_type: proc_macro2::TokenStream,103	fields_count: usize,104) -> proc_macro2::TokenStream {105	quote! {106		impl ::evm_coder::abi::AbiType for #name {107			const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <#tuple_type as ::evm_coder::abi::AbiType>::SIGNATURE;108			const FIELDS_COUNT: usize = #fields_count;109			fn is_dynamic() -> bool {110				<#tuple_type as ::evm_coder::abi::AbiType>::is_dynamic()111			}112			fn size() -> usize {113				<#tuple_type as ::evm_coder::abi::AbiType>::size()114			}115		}116	}117}118119pub fn impl_struct_abi_read(120	name: &syn::Ident,121	tuple_type: proc_macro2::TokenStream,122	tuple_names: proc_macro2::TokenStream,123	struct_from_tuple: proc_macro2::TokenStream,124) -> proc_macro2::TokenStream {125	quote!(126		impl ::evm_coder::abi::AbiRead for #name {127			fn abi_read(reader: &mut ::evm_coder::abi::AbiReader) -> ::evm_coder::execution::Result<Self> {128				let #tuple_names = <#tuple_type as ::evm_coder::abi::AbiRead>::abi_read(reader)?;129				Ok(#struct_from_tuple)130			}131		}132	)133}134135pub fn impl_struct_abi_write(136	name: &syn::Ident,137	_is_named_fields: bool,138	tuple_type: proc_macro2::TokenStream,139	tuple_data: proc_macro2::TokenStream,140) -> proc_macro2::TokenStream {141	quote!(142		impl ::evm_coder::abi::AbiWrite for #name {143			fn abi_write(&self, writer: &mut ::evm_coder::abi::AbiWriter) {144				<#tuple_type as ::evm_coder::abi::AbiWrite>::abi_write(&#tuple_data, writer)145			}146		}147	)148}149150pub fn impl_struct_solidity_type<'a>(151	name: &syn::Ident,152	field_types: impl Iterator<Item = &'a syn::Type> + Clone,153	params_count: usize,154) -> proc_macro2::TokenStream {155	let len = proc_macro2::Literal::usize_suffixed(params_count);156	quote! {157		#[cfg(feature = "stubgen")]158		impl ::evm_coder::solidity::SolidityType for #name {159			fn names(tc: &::evm_coder::solidity::TypeCollector) -> Vec<String> {160				let mut collected =161					Vec::with_capacity(<Self as ::evm_coder::solidity::SolidityType>::len());162				#({163					let mut out = String::new();164					<#field_types as ::evm_coder::solidity::SolidityTypeName>::solidity_name(&mut out, tc)165						.expect("no fmt error");166					collected.push(out);167				})*168				collected169			}170171			fn len() -> usize {172				#len173			}174		}175	}176}177178pub fn impl_struct_solidity_type_name<'a>(179	name: &syn::Ident,180	field_types: impl Iterator<Item = &'a syn::Type> + Clone,181	params_count: usize,182) -> proc_macro2::TokenStream {183	let arg_dafaults = field_types.enumerate().map(|(i, ty)| {184		let mut defult_value = quote!(<#ty as ::evm_coder::solidity::SolidityTypeName185			>::solidity_default(writer, tc)?;);186		let last_item = params_count - 1;187		if i != last_item {188			defult_value.extend(quote! {write!(writer, ",")?;})189		}190		defult_value191	});192193	quote! {194		#[cfg(feature = "stubgen")]195		impl ::evm_coder::solidity::SolidityTypeName for #name {196			fn solidity_name(197				writer: &mut impl ::core::fmt::Write,198				tc: &::evm_coder::solidity::TypeCollector,199			) -> ::core::fmt::Result {200				write!(writer, "{}", tc.collect_struct::<Self>())201			}202203			fn is_simple() -> bool {204				false205			}206207			fn solidity_default(208				writer: &mut impl ::core::fmt::Write,209				tc: &::evm_coder::solidity::TypeCollector,210			) -> ::core::fmt::Result {211				write!(writer, "{}(", tc.collect_struct::<Self>())?;212213				#(#arg_dafaults)*214215				write!(writer, ")")216			}217		}218	}219}220221pub fn impl_struct_solidity_struct_collect<'a>(222	name: &syn::Ident,223	field_names: impl Iterator<Item = proc_macro2::Ident> + Clone,224	field_types: impl Iterator<Item = &'a syn::Type> + Clone,225	field_docs: impl Iterator<Item = syn::Result<Vec<proc_macro2::TokenStream>>> + Clone,226	docs: &[proc_macro2::TokenStream],227) -> syn::Result<proc_macro2::TokenStream> {228	let string_name = name.to_string();229	let name_type = field_names230		.into_iter()231		.zip(field_types)232		.zip(field_docs)233		.map(|((name, ty), doc)| {234			let field_docs = doc.expect("Doc parse error");235			let name = format!("{}", name);236			quote!(237				#(#field_docs)*238				write!(str, "\t{} ", <#ty as ::evm_coder::solidity::StructCollect>::name()).unwrap();239				writeln!(str, "{};", #name).unwrap();240			)241		});242243	Ok(quote! {244		#[cfg(feature = "stubgen")]245		impl ::evm_coder::solidity::StructCollect for #name {246			fn name() -> String {247				#string_name.into()248			}249250			fn declaration() -> String {251				use std::fmt::Write;252253				let mut str = String::new();254				#(#docs)*255				writeln!(str, "struct {} {{", Self::name()).unwrap();256				#(#name_type)*257				writeln!(str, "}}").unwrap();258				str259			}260		}261	})262}
after · crates/evm-coder/procedural/src/abi_derive/derive_struct.rs
1use super::extract_docs;2use quote::quote;34pub fn tuple_type<'a>(5	field_types: impl Iterator<Item = &'a syn::Type> + Clone,6) -> proc_macro2::TokenStream {7	let field_types = field_types.map(|ty| quote!(#ty,));8	quote! {(#(#field_types)*)}9}1011pub fn tuple_ref_type<'a>(12	field_types: impl Iterator<Item = &'a syn::Type> + Clone,13) -> proc_macro2::TokenStream {14	let field_types = field_types.map(|ty| quote!(&#ty,));15	quote! {(#(#field_types)*)}16}1718pub fn tuple_data_as_ref(19	is_named_fields: bool,20	field_names: impl Iterator<Item = syn::Ident> + Clone,21) -> proc_macro2::TokenStream {22	let field_names = field_names.enumerate().map(|(i, field)| {23		if is_named_fields {24			quote!(&self.#field,)25		} else {26			let field = proc_macro2::Literal::usize_unsuffixed(i);27			quote!(&self.#field,)28		}29	});30	quote! {(#(#field_names)*)}31}3233pub fn tuple_names(34	is_named_fields: bool,35	field_names: impl Iterator<Item = syn::Ident> + Clone,36) -> proc_macro2::TokenStream {37	let field_names = field_names.enumerate().map(|(i, field)| {38		if is_named_fields {39			quote!(#field,)40		} else {41			let field = proc_macro2::Ident::new(42				format!("field{}", i).as_str(),43				proc_macro2::Span::call_site(),44			);45			quote!(#field,)46		}47	});48	quote! {(#(#field_names)*)}49}5051pub fn struct_from_tuple(52	name: &syn::Ident,53	is_named_fields: bool,54	field_names: impl Iterator<Item = syn::Ident> + Clone,55) -> proc_macro2::TokenStream {56	let field_names = field_names.enumerate().map(|(i, field)| {57		if is_named_fields {58			quote!(#field,)59		} else {60			let field = proc_macro2::Ident::new(61				format!("field{}", i).as_str(),62				proc_macro2::Span::call_site(),63			);64			quote!(#field,)65		}66	});6768	if is_named_fields {69		quote! {#name {#(#field_names)*}}70	} else {71		quote! {#name (#(#field_names)*)}72	}73}7475pub fn map_field_to_name(field: (usize, &syn::Field)) -> syn::Ident {76	match field.1.ident.as_ref() {77		Some(name) => name.clone(),78		None => {79			let mut name = "field".to_string();80			name.push_str(field.0.to_string().as_str());81			syn::Ident::new(name.as_str(), proc_macro2::Span::call_site())82		}83	}84}8586pub fn map_field_to_type(field: &syn::Field) -> &syn::Type {87	&field.ty88}8990pub fn map_field_to_doc(field: &syn::Field) -> syn::Result<Vec<proc_macro2::TokenStream>> {91	extract_docs(&field.attrs, true)92}9394pub fn impl_can_be_placed_in_vec(ident: &syn::Ident) -> proc_macro2::TokenStream {95	quote! {96		impl ::evm_coder::sealed::CanBePlacedInVec for #ident {}97	}98}99100pub fn impl_struct_abi_type(101	name: &syn::Ident,102	tuple_type: proc_macro2::TokenStream,103) -> proc_macro2::TokenStream {104	quote! {105		impl ::evm_coder::abi::AbiType for #name {106			const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <#tuple_type as ::evm_coder::abi::AbiType>::SIGNATURE;107			fn is_dynamic() -> bool {108				<#tuple_type as ::evm_coder::abi::AbiType>::is_dynamic()109			}110			fn size() -> usize {111				<#tuple_type as ::evm_coder::abi::AbiType>::size()112			}113		}114	}115}116117pub fn impl_struct_abi_read(118	name: &syn::Ident,119	tuple_type: proc_macro2::TokenStream,120	tuple_names: proc_macro2::TokenStream,121	struct_from_tuple: proc_macro2::TokenStream,122) -> proc_macro2::TokenStream {123	quote!(124		impl ::evm_coder::abi::AbiRead for #name {125			fn abi_read(reader: &mut ::evm_coder::abi::AbiReader) -> ::evm_coder::execution::Result<Self> {126				let #tuple_names = <#tuple_type as ::evm_coder::abi::AbiRead>::abi_read(reader)?;127				Ok(#struct_from_tuple)128			}129		}130	)131}132133pub fn impl_struct_abi_write(134	name: &syn::Ident,135	_is_named_fields: bool,136	tuple_type: proc_macro2::TokenStream,137	tuple_data: proc_macro2::TokenStream,138) -> proc_macro2::TokenStream {139	quote!(140		impl ::evm_coder::abi::AbiWrite for #name {141			fn abi_write(&self, writer: &mut ::evm_coder::abi::AbiWriter) {142				<#tuple_type as ::evm_coder::abi::AbiWrite>::abi_write(&#tuple_data, writer)143			}144		}145	)146}147148pub fn impl_struct_solidity_type<'a>(149	name: &syn::Ident,150	field_types: impl Iterator<Item = &'a syn::Type> + Clone,151	params_count: usize,152) -> proc_macro2::TokenStream {153	let len = proc_macro2::Literal::usize_suffixed(params_count);154	quote! {155		#[cfg(feature = "stubgen")]156		impl ::evm_coder::solidity::SolidityType for #name {157			fn names(tc: &::evm_coder::solidity::TypeCollector) -> Vec<String> {158				let mut collected =159					Vec::with_capacity(<Self as ::evm_coder::solidity::SolidityType>::len());160				#({161					let mut out = String::new();162					<#field_types as ::evm_coder::solidity::SolidityTypeName>::solidity_name(&mut out, tc)163						.expect("no fmt error");164					collected.push(out);165				})*166				collected167			}168169			fn len() -> usize {170				#len171			}172		}173	}174}175176pub fn impl_struct_solidity_type_name<'a>(177	name: &syn::Ident,178	field_types: impl Iterator<Item = &'a syn::Type> + Clone,179	params_count: usize,180) -> proc_macro2::TokenStream {181	let arg_dafaults = field_types.enumerate().map(|(i, ty)| {182		let mut defult_value = quote!(<#ty as ::evm_coder::solidity::SolidityTypeName183			>::solidity_default(writer, tc)?;);184		let last_item = params_count - 1;185		if i != last_item {186			defult_value.extend(quote! {write!(writer, ",")?;})187		}188		defult_value189	});190191	quote! {192		#[cfg(feature = "stubgen")]193		impl ::evm_coder::solidity::SolidityTypeName for #name {194			fn solidity_name(195				writer: &mut impl ::core::fmt::Write,196				tc: &::evm_coder::solidity::TypeCollector,197			) -> ::core::fmt::Result {198				write!(writer, "{}", tc.collect_struct::<Self>())199			}200201			fn is_simple() -> bool {202				false203			}204205			fn solidity_default(206				writer: &mut impl ::core::fmt::Write,207				tc: &::evm_coder::solidity::TypeCollector,208			) -> ::core::fmt::Result {209				write!(writer, "{}(", tc.collect_struct::<Self>())?;210211				#(#arg_dafaults)*212213				write!(writer, ")")214			}215		}216	}217}218219pub fn impl_struct_solidity_struct_collect<'a>(220	name: &syn::Ident,221	field_names: impl Iterator<Item = proc_macro2::Ident> + Clone,222	field_types: impl Iterator<Item = &'a syn::Type> + Clone,223	field_docs: impl Iterator<Item = syn::Result<Vec<proc_macro2::TokenStream>>> + Clone,224	docs: &[proc_macro2::TokenStream],225) -> syn::Result<proc_macro2::TokenStream> {226	let string_name = name.to_string();227	let name_type = field_names228		.into_iter()229		.zip(field_types)230		.zip(field_docs)231		.map(|((name, ty), doc)| {232			let field_docs = doc.expect("Doc parse error");233			let name = format!("{}", name);234			quote!(235				#(#field_docs)*236				write!(str, "\t{} ", <#ty as ::evm_coder::solidity::StructCollect>::name()).unwrap();237				writeln!(str, "{};", #name).unwrap();238			)239		});240241	Ok(quote! {242		#[cfg(feature = "stubgen")]243		impl ::evm_coder::solidity::StructCollect for #name {244			fn name() -> String {245				#string_name.into()246			}247248			fn declaration() -> String {249				use std::fmt::Write;250251				let mut str = String::new();252				#(#docs)*253				writeln!(str, "struct {} {{", Self::name()).unwrap();254				#(#name_type)*255				writeln!(str, "}}").unwrap();256				str257			}258		}259	})260}
modifiedcrates/evm-coder/procedural/src/abi_derive/mod.rsdiffbeforeafterboth
--- a/crates/evm-coder/procedural/src/abi_derive/mod.rs
+++ b/crates/evm-coder/procedural/src/abi_derive/mod.rs
@@ -49,7 +49,7 @@
 	let struct_from_tuple = struct_from_tuple(name, is_named_fields, field_names.clone());
 
 	let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);
-	let abi_type = impl_struct_abi_type(name, tuple_type.clone(), params_count);
+	let abi_type = impl_struct_abi_type(name, tuple_type.clone());
 	let abi_read = impl_struct_abi_read(name, tuple_type, tuple_names, struct_from_tuple);
 	let abi_write = impl_struct_abi_write(name, is_named_fields, tuple_ref_type, tuple_data);
 	let solidity_type = impl_struct_solidity_type(name, field_types.clone(), params_count);
@@ -83,7 +83,7 @@
 	let from = impl_enum_from_u8(name, enum_options.clone());
 	let solidity_option = impl_solidity_option(name, enum_options.clone());
 	let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);
-	let abi_type = impl_enum_abi_type(name, option_count);
+	let abi_type = impl_enum_abi_type(name);
 	let abi_read = impl_enum_abi_read(name);
 	let abi_write = impl_enum_abi_write(name);
 	let solidity_type = impl_enum_solidity_type(name);
modifiedcrates/evm-coder/src/abi/impls.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi/impls.rs
+++ b/crates/evm-coder/src/abi/impls.rs
@@ -16,7 +16,6 @@
 
 		impl AbiType for $ty {
 			const SIGNATURE: SignatureUnit = make_signature!(new fixed(stringify!($name)));
-			const FIELDS_COUNT: usize = 1;
 
 			fn is_dynamic() -> bool {
 				$dynamic
@@ -97,7 +96,6 @@
 
 impl<T: AbiType> AbiType for &T {
 	const SIGNATURE: SignatureUnit = T::SIGNATURE;
-	const FIELDS_COUNT: usize = T::FIELDS_COUNT;
 
 	fn is_dynamic() -> bool {
 		T::is_dynamic()
@@ -127,7 +125,6 @@
 
 impl<T: AbiType> AbiType for Vec<T> {
 	const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));
-	const FIELDS_COUNT: usize = 1;
 
 	fn is_dynamic() -> bool {
 		true
@@ -203,7 +200,6 @@
                 shift_left(1)
                 fixed(")")
             );
-			const FIELDS_COUNT: usize = count!($($ident)*);
 
 			fn is_dynamic() -> bool {
 				false
modifiedcrates/evm-coder/src/abi/traits.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi/traits.rs
+++ b/crates/evm-coder/src/abi/traits.rs
@@ -10,9 +10,6 @@
 	/// Signature for Etherium ABI.
 	const SIGNATURE: SignatureUnit;
 
-	/// Count of enum variants or struct fields.
-	const FIELDS_COUNT: usize;
-
 	/// Signature as str.
 	fn as_str() -> &'static str {
 		from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")
modifiedcrates/evm-coder/tests/abi_derive_generation.rsdiffbeforeafterboth
--- a/crates/evm-coder/tests/abi_derive_generation.rs
+++ b/crates/evm-coder/tests/abi_derive_generation.rs
@@ -173,50 +173,6 @@
 	}
 
 	#[test]
-	fn impl_abi_type_fields_count() {
-		assert_eq!(
-			<TypeStruct1SimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			1
-		);
-		assert_eq!(
-			<TypeStruct1DynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			1
-		);
-		assert_eq!(
-			<TypeStruct2SimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct2DynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct2MixedParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct1DerivedSimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			1
-		);
-		assert_eq!(
-			<TypeStruct2DerivedSimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct1DerivedDynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			1
-		);
-		assert_eq!(
-			<TypeStruct2DerivedDynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			2
-		);
-		assert_eq!(
-			<TypeStruct3DerivedMixedParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
-			3
-		);
-	}
-
-	#[test]
 	fn impl_abi_type_is_dynamic() {
 		assert_eq!(
 			<TypeStruct1SimpleParam as evm_coder::abi::AbiType>::is_dynamic(),
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -347,6 +347,10 @@
 	) -> Result<void> {
 		self.consume_store_reads_and_writes(1, 1)?;
 
+		if !limit.has_value() {
+			return Err(Error::Revert("user can't disable limits".into()));
+		}
+
 		let caller = T::CrossAccountId::from_eth(caller);
 		<Pallet<T>>::update_limits(&caller, self, limit.try_into()?).map_err(dispatch_to_evm::<T>)
 	}
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -264,16 +264,17 @@
 			value: value.into(),
 		}
 	}
+
+	/// Whether the field contains a value.
+	pub fn has_value(&self) -> bool {
+		self.value.status
+	}
 }
 
 impl TryInto<up_data_structs::CollectionLimits> for CollectionLimit {
 	type Error = evm_coder::execution::Error;
 
 	fn try_into(self) -> Result<up_data_structs::CollectionLimits, Self::Error> {
-		if !self.value.status {
-			return Err(Self::Error::Revert("user can't disable limits".into()));
-		}
-
 		let value = self.value.value.try_into().map_err(|error| {
 			Self::Error::Revert(format!(
 				"can't convert value to u32 \"{}\" because: \"{error}\"",
@@ -433,17 +434,6 @@
 		let mut perms = Vec::new();
 
 		for TokenPropertyPermission { key, permissions } in permissions {
-			if permissions.len() > <TokenPermissionField as evm_coder::abi::AbiType>::FIELDS_COUNT {
-				return Err(alloc::format!(
-					"Actual number of fields {} for {}, which exceeds the maximum value of {}",
-					permissions.len(),
-					stringify!(EthTokenPermissions),
-					<TokenPermissionField as evm_coder::abi::AbiType>::FIELDS_COUNT
-				)
-				.as_str()
-				.into());
-			}
-
 			let token_permission = PropertyPermission::from_vec(permissions);
 
 			perms.push(up_data_structs::PropertyKeyPermission {
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -38,6 +38,7 @@
 use pallet_common::{
 	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
 	erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},
+	eth,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::call;
@@ -93,25 +94,21 @@
 	fn set_token_property_permissions(
 		&mut self,
 		caller: caller,
-		permissions: Vec<pallet_common::eth::TokenPropertyPermission>,
+		permissions: Vec<eth::TokenPropertyPermission>,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
-		let perms = pallet_common::eth::TokenPropertyPermission::into_property_key_permissions(
-			permissions,
-		)?;
+		let perms = eth::TokenPropertyPermission::into_property_key_permissions(permissions)?;
 
 		<Pallet<T>>::set_token_property_permissions(self, &caller, perms)
 			.map_err(dispatch_to_evm::<T>)
 	}
 
 	/// @notice Get permissions for token properties.
-	fn token_property_permissions(
-		&self,
-	) -> Result<Vec<pallet_common::eth::TokenPropertyPermission>> {
+	fn token_property_permissions(&self) -> Result<Vec<eth::TokenPropertyPermission>> {
 		let perms = <Pallet<T>>::token_property_permission(self.id);
 		Ok(perms
 			.into_iter()
-			.map(pallet_common::eth::TokenPropertyPermission::from)
+			.map(eth::TokenPropertyPermission::from)
 			.collect())
 	}
 
@@ -159,7 +156,7 @@
 		&mut self,
 		caller: caller,
 		token_id: uint256,
-		properties: Vec<pallet_common::eth::Property>,
+		properties: Vec<eth::Property>,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -170,7 +167,7 @@
 
 		let properties = properties
 			.into_iter()
-			.map(pallet_common::eth::Property::try_into)
+			.map(eth::Property::try_into)
 			.collect::<Result<Vec<_>>>()?;
 
 		<Pallet<T>>::set_token_properties(
@@ -753,9 +750,9 @@
 	/// Returns the owner (in cross format) of the token.
 	///
 	/// @param tokenId Id for the token.
-	fn cross_owner_of(&self, token_id: uint256) -> Result<pallet_common::eth::CrossAddress> {
+	fn cross_owner_of(&self, token_id: uint256) -> Result<eth::CrossAddress> {
 		Self::token_owner(&self, token_id.try_into()?)
-			.map(|o| pallet_common::eth::CrossAddress::from_sub_cross_account::<T>(&o))
+			.map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
 			.ok_or(Error::Revert("key too large".into()))
 	}
 
@@ -764,11 +761,7 @@
 	/// @param tokenId Id for the token.
 	/// @param keys Properties keys. Empty keys for all propertyes.
 	/// @return Vector of properties key/value pairs.
-	fn properties(
-		&self,
-		token_id: uint256,
-		keys: Vec<string>,
-	) -> Result<Vec<pallet_common::eth::Property>> {
+	fn properties(&self, token_id: uint256, keys: Vec<string>) -> Result<Vec<eth::Property>> {
 		let keys = keys
 			.into_iter()
 			.map(|key| {
@@ -784,7 +777,7 @@
 			if keys.is_empty() { None } else { Some(keys) },
 		)
 		.into_iter()
-		.map(pallet_common::eth::Property::try_from)
+		.map(eth::Property::try_from)
 		.collect::<Result<Vec<_>>>()
 	}
 
@@ -798,7 +791,7 @@
 	fn approve_cross(
 		&mut self,
 		caller: caller,
-		approved: pallet_common::eth::CrossAddress,
+		approved: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -837,7 +830,7 @@
 	fn transfer_cross(
 		&mut self,
 		caller: caller,
-		to: pallet_common::eth::CrossAddress,
+		to: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -861,8 +854,8 @@
 	fn transfer_from_cross(
 		&mut self,
 		caller: caller,
-		from: pallet_common::eth::CrossAddress,
-		to: pallet_common::eth::CrossAddress,
+		from: eth::CrossAddress,
+		to: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -908,7 +901,7 @@
 	fn burn_from_cross(
 		&mut self,
 		caller: caller,
-		from: pallet_common::eth::CrossAddress,
+		from: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -1030,8 +1023,8 @@
 	fn mint_cross(
 		&mut self,
 		caller: caller,
-		to: pallet_common::eth::CrossAddress,
-		properties: Vec<pallet_common::eth::Property>,
+		to: eth::CrossAddress,
+		properties: Vec<eth::Property>,
 	) -> Result<uint256> {
 		let token_id = <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
@@ -1041,7 +1034,7 @@
 
 		let properties = properties
 			.into_iter()
-			.map(pallet_common::eth::Property::try_into)
+			.map(eth::Property::try_into)
 			.collect::<Result<Vec<_>>>()?
 			.try_into()
 			.map_err(|_| Error::Revert(alloc::format!("too many properties")))?;
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -32,8 +32,9 @@
 use frame_support::{BoundedBTreeMap, BoundedVec};
 use pallet_common::{
 	CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
+	Error as CommonError,
 	erc::{CommonEvmHandler, CollectionCall, static_property::key},
-	Error as CommonError,
+	eth,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{call, dispatch_to_evm};
@@ -96,25 +97,21 @@
 	fn set_token_property_permissions(
 		&mut self,
 		caller: caller,
-		permissions: Vec<pallet_common::eth::TokenPropertyPermission>,
+		permissions: Vec<eth::TokenPropertyPermission>,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
-		let perms = pallet_common::eth::TokenPropertyPermission::into_property_key_permissions(
-			permissions,
-		)?;
+		let perms = eth::TokenPropertyPermission::into_property_key_permissions(permissions)?;
 
 		<Pallet<T>>::set_token_property_permissions(self, &caller, perms)
 			.map_err(dispatch_to_evm::<T>)
 	}
 
 	/// @notice Get permissions for token properties.
-	fn token_property_permissions(
-		&self,
-	) -> Result<Vec<pallet_common::eth::TokenPropertyPermission>> {
+	fn token_property_permissions(&self) -> Result<Vec<eth::TokenPropertyPermission>> {
 		let perms = <Pallet<T>>::token_property_permission(self.id);
 		Ok(perms
 			.into_iter()
-			.map(pallet_common::eth::TokenPropertyPermission::from)
+			.map(eth::TokenPropertyPermission::from)
 			.collect())
 	}
 
@@ -162,7 +159,7 @@
 		&mut self,
 		caller: caller,
 		token_id: uint256,
-		properties: Vec<pallet_common::eth::Property>,
+		properties: Vec<eth::Property>,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -173,7 +170,7 @@
 
 		let properties = properties
 			.into_iter()
-			.map(pallet_common::eth::Property::try_into)
+			.map(eth::Property::try_into)
 			.collect::<Result<Vec<_>>>()?;
 
 		<Pallet<T>>::set_token_properties(
@@ -788,9 +785,9 @@
 	/// Returns the owner (in cross format) of the token.
 	///
 	/// @param tokenId Id for the token.
-	fn cross_owner_of(&self, token_id: uint256) -> Result<pallet_common::eth::CrossAddress> {
+	fn cross_owner_of(&self, token_id: uint256) -> Result<eth::CrossAddress> {
 		Self::token_owner(&self, token_id.try_into()?)
-			.map(|o| pallet_common::eth::CrossAddress::from_sub_cross_account::<T>(&o))
+			.map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
 			.ok_or(Error::Revert("key too large".into()))
 	}
 
@@ -799,11 +796,7 @@
 	/// @param tokenId Id for the token.
 	/// @param keys Properties keys. Empty keys for all propertyes.
 	/// @return Vector of properties key/value pairs.
-	fn properties(
-		&self,
-		token_id: uint256,
-		keys: Vec<string>,
-	) -> Result<Vec<pallet_common::eth::Property>> {
+	fn properties(&self, token_id: uint256, keys: Vec<string>) -> Result<Vec<eth::Property>> {
 		let keys = keys
 			.into_iter()
 			.map(|key| {
@@ -819,7 +812,7 @@
 			if keys.is_empty() { None } else { Some(keys) },
 		)
 		.into_iter()
-		.map(pallet_common::eth::Property::try_from)
+		.map(eth::Property::try_from)
 		.collect::<Result<Vec<_>>>()
 	}
 	/// @notice Transfer ownership of an RFT
@@ -855,7 +848,7 @@
 	fn transfer_cross(
 		&mut self,
 		caller: caller,
-		to: pallet_common::eth::CrossAddress,
+		to: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -883,8 +876,8 @@
 	fn transfer_from_cross(
 		&mut self,
 		caller: caller,
-		from: pallet_common::eth::CrossAddress,
-		to: pallet_common::eth::CrossAddress,
+		from: eth::CrossAddress,
+		to: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -939,7 +932,7 @@
 	fn burn_from_cross(
 		&mut self,
 		caller: caller,
-		from: pallet_common::eth::CrossAddress,
+		from: eth::CrossAddress,
 		token_id: uint256,
 	) -> Result<void> {
 		let caller = T::CrossAccountId::from_eth(caller);
@@ -1076,8 +1069,8 @@
 	fn mint_cross(
 		&mut self,
 		caller: caller,
-		to: pallet_common::eth::CrossAddress,
-		properties: Vec<pallet_common::eth::Property>,
+		to: eth::CrossAddress,
+		properties: Vec<eth::Property>,
 	) -> Result<uint256> {
 		let token_id = <TokensMinted<T>>::get(self.id)
 			.checked_add(1)
@@ -1087,7 +1080,7 @@
 
 		let properties = properties
 			.into_iter()
-			.map(pallet_common::eth::Property::try_into)
+			.map(eth::Property::try_into)
 			.collect::<Result<Vec<_>>>()?
 			.try_into()
 			.map_err(|_| Error::Revert(alloc::format!("too many properties")))?;