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
--- a/crates/evm-coder/procedural/src/abi_derive/derive_struct.rs
+++ b/crates/evm-coder/procedural/src/abi_derive/derive_struct.rs
@@ -100,12 +100,10 @@
 pub fn impl_struct_abi_type(
 	name: &syn::Ident,
 	tuple_type: proc_macro2::TokenStream,
-	fields_count: usize,
 ) -> proc_macro2::TokenStream {
 	quote! {
 		impl ::evm_coder::abi::AbiType for #name {
 			const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <#tuple_type as ::evm_coder::abi::AbiType>::SIGNATURE;
-			const FIELDS_COUNT: usize = #fields_count;
 			fn is_dynamic() -> bool {
 				<#tuple_type as ::evm_coder::abi::AbiType>::is_dynamic()
 			}
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
before · crates/evm-coder/src/abi/impls.rs
1use crate::{2	custom_signature::SignatureUnit,3	execution::{Result, ResultWithPostInfo, WithPostDispatchInfo},4	make_signature, sealed,5	types::*,6};7use super::{traits::*, ABI_ALIGNMENT, AbiReader, AbiWriter};8use primitive_types::{U256, H160};910#[cfg(not(feature = "std"))]11use alloc::vec::Vec;1213macro_rules! impl_abi_type {14	($ty:ty, $name:ident, $dynamic:literal) => {15		impl sealed::CanBePlacedInVec for $ty {}1617		impl AbiType for $ty {18			const SIGNATURE: SignatureUnit = make_signature!(new fixed(stringify!($name)));19			const FIELDS_COUNT: usize = 1;2021			fn is_dynamic() -> bool {22				$dynamic23			}2425			fn size() -> usize {26				ABI_ALIGNMENT27			}28		}29	};30}3132macro_rules! impl_abi_readable {33	($ty:ty, $method:ident) => {34		impl AbiRead for $ty {35			fn abi_read(reader: &mut AbiReader) -> Result<$ty> {36				reader.$method()37			}38		}39	};40}4142macro_rules! impl_abi_writeable {43	($ty:ty, $method:ident) => {44		impl AbiWrite for $ty {45			fn abi_write(&self, writer: &mut AbiWriter) {46				writer.$method(&self)47			}48		}49	};50}5152macro_rules! impl_abi {53	($ty:ty, $method:ident, $dynamic:literal) => {54		impl_abi_type!($ty, $method, $dynamic);55		impl_abi_readable!($ty, $method);56		impl_abi_writeable!($ty, $method);57	};58}5960impl_abi!(bool, bool, false);61impl_abi!(u8, uint8, false);62impl_abi!(u32, uint32, false);63impl_abi!(u64, uint64, false);64impl_abi!(u128, uint128, false);65impl_abi!(U256, uint256, false);66impl_abi!(H160, address, false);67impl_abi!(string, string, true);6869impl_abi_writeable!(&str, string);7071impl_abi_type!(bytes, bytes, true);7273impl AbiRead for bytes {74	fn abi_read(reader: &mut AbiReader) -> Result<bytes> {75		Ok(bytes(reader.bytes()?))76	}77}7879impl AbiWrite for bytes {80	fn abi_write(&self, writer: &mut AbiWriter) {81		writer.bytes(self.0.as_slice())82	}83}8485impl_abi_type!(bytes4, bytes4, false);86impl AbiRead for bytes4 {87	fn abi_read(reader: &mut AbiReader) -> Result<bytes4> {88		reader.bytes4()89	}90}9192impl<T: AbiWrite> AbiWrite for &T {93	fn abi_write(&self, writer: &mut AbiWriter) {94		T::abi_write(self, writer);95	}96}9798impl<T: AbiType> AbiType for &T {99	const SIGNATURE: SignatureUnit = T::SIGNATURE;100	const FIELDS_COUNT: usize = T::FIELDS_COUNT;101102	fn is_dynamic() -> bool {103		T::is_dynamic()104	}105106	fn size() -> usize {107		T::size()108	}109}110111impl<T: AbiType + AbiRead + sealed::CanBePlacedInVec> AbiRead for Vec<T> {112	fn abi_read(reader: &mut AbiReader) -> Result<Vec<T>> {113		let mut sub = reader.subresult(None)?;114		let size = sub.uint32()? as usize;115		sub.subresult_offset = sub.offset;116		let is_dynamic = <T as AbiType>::is_dynamic();117		let mut out = Vec::with_capacity(size);118		for _ in 0..size {119			out.push(<T as AbiRead>::abi_read(&mut sub)?);120			if !is_dynamic {121				sub.bytes_read(<T as AbiType>::size());122			};123		}124		Ok(out)125	}126}127128impl<T: AbiType> AbiType for Vec<T> {129	const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));130	const FIELDS_COUNT: usize = 1;131132	fn is_dynamic() -> bool {133		true134	}135136	fn size() -> usize {137		ABI_ALIGNMENT138	}139}140141impl<T: AbiWrite + AbiType> AbiWrite for Vec<T> {142	fn abi_write(&self, writer: &mut AbiWriter) {143		let is_dynamic = T::is_dynamic();144		let mut sub = if is_dynamic {145			AbiWriter::new_dynamic(is_dynamic)146		} else {147			AbiWriter::new()148		};149150		// Write items count151		(self.len() as u32).abi_write(&mut sub);152153		for item in self {154			item.abi_write(&mut sub);155		}156		writer.write_subresult(sub);157	}158}159160impl AbiWrite for () {161	fn abi_write(&self, _writer: &mut AbiWriter) {}162}163164/// This particular AbiWrite implementation should be split to another trait,165/// which only implements `to_result`, but due to lack of specialization feature166/// in stable Rust, we can't have blanket impl of this trait `for T where T: AbiWrite`,167/// so here we abusing default trait methods for it168impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {169	fn abi_write(&self, _writer: &mut AbiWriter) {170		debug_assert!(false, "shouldn't be called, see comment")171	}172	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {173		match self {174			Ok(v) => Ok(WithPostDispatchInfo {175				post_info: v.post_info.clone(),176				data: {177					let mut out = AbiWriter::new();178					v.data.abi_write(&mut out);179					out180				},181			}),182			Err(e) => Err(e.clone()),183		}184	}185}186187macro_rules! count {188    () => (0usize);189    ( $x:tt $($xs:tt)* ) => (1usize + count!($($xs)*));190}191192macro_rules! impl_tuples {193	($($ident:ident)+) => {194		impl<$($ident: AbiType,)+> AbiType for ($($ident,)+)195		where196        $(197            $ident: AbiType,198        )+199		{200            const SIGNATURE: SignatureUnit = make_signature!(201                new fixed("(")202                $(nameof(<$ident>::SIGNATURE) fixed(","))+203                shift_left(1)204                fixed(")")205            );206			const FIELDS_COUNT: usize = count!($($ident)*);207208			fn is_dynamic() -> bool {209				false210				$(211					|| <$ident>::is_dynamic()212				)*213			}214215			fn size() -> usize {216				0 $(+ <$ident>::size())+217			}218		}219220		impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}221222		impl<$($ident),+> AbiRead for ($($ident,)+)223		where224			Self: AbiType,225			$($ident: AbiRead + AbiType,)+226		{227			fn abi_read(reader: &mut AbiReader) -> Result<($($ident,)+)> {228				let is_dynamic = <Self>::is_dynamic();229				let size = if !is_dynamic { Some(<Self>::size()) } else { None };230				let mut subresult = reader.subresult(size)?;231				Ok((232					$({233						let value = <$ident>::abi_read(&mut subresult)?;234						if !is_dynamic {subresult.bytes_read(<$ident as AbiType>::size())};235						value236					},)+237				))238			}239		}240241		#[allow(non_snake_case)]242		impl<$($ident),+> AbiWrite for ($($ident,)+)243		where244			$($ident: AbiWrite + AbiType,)+245		{246			fn abi_write(&self, writer: &mut AbiWriter) {247				let ($($ident,)+) = self;248				if <Self as AbiType>::is_dynamic() {249					let mut sub = AbiWriter::new();250					$($ident.abi_write(&mut sub);)+251					writer.write_subresult(sub);252				} else {253					$($ident.abi_write(writer);)+254				}255			}256		}257	};258}259260impl_tuples! {A}261impl_tuples! {A B}262impl_tuples! {A B C}263impl_tuples! {A B C D}264impl_tuples! {A B C D E}265impl_tuples! {A B C D E F}266impl_tuples! {A B C D E F G}267impl_tuples! {A B C D E F G H}268impl_tuples! {A B C D E F G H I}269impl_tuples! {A B C D E F G H I J}
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")))?;