git.delta.rocks / unique-network / refs/commits / 64d0cdb0c53e

difftreelog

refac: rename bytes -> Bytes

Trubnikov Sergey2023-01-18parent: #7d542e4.patch.diff
in: master

9 files changed

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)));1920			fn is_dynamic() -> bool {21				$dynamic22			}2324			fn size() -> usize {25				ABI_ALIGNMENT26			}27		}28	};29}3031macro_rules! impl_abi_readable {32	($ty:ty, $method:ident) => {33		impl AbiRead for $ty {34			fn abi_read(reader: &mut AbiReader) -> Result<$ty> {35				reader.$method()36			}37		}38	};39}4041macro_rules! impl_abi_writeable {42	($ty:ty, $method:ident) => {43		impl AbiWrite for $ty {44			fn abi_write(&self, writer: &mut AbiWriter) {45				writer.$method(&self)46			}47		}48	};49}5051macro_rules! impl_abi {52	($ty:ty, $method:ident, $dynamic:literal) => {53		impl_abi_type!($ty, $method, $dynamic);54		impl_abi_readable!($ty, $method);55		impl_abi_writeable!($ty, $method);56	};57}5859impl_abi!(bool, bool, false);60impl_abi!(u8, uint8, false);61impl_abi!(u32, uint32, false);62impl_abi!(u64, uint64, false);63impl_abi!(u128, uint128, false);64impl_abi!(U256, uint256, false);65impl_abi!(H160, address, false);66impl_abi!(String, string, true);6768impl_abi_writeable!(&str, string);6970impl_abi_type!(bytes, bytes, true);7172impl AbiRead for bytes {73	fn abi_read(reader: &mut AbiReader) -> Result<bytes> {74		Ok(bytes(reader.bytes()?))75	}76}7778impl AbiWrite for bytes {79	fn abi_write(&self, writer: &mut AbiWriter) {80		writer.bytes(self.0.as_slice())81	}82}8384impl_abi_type!(Bytes4, bytes4, false);85impl AbiRead for Bytes4 {86	fn abi_read(reader: &mut AbiReader) -> Result<Bytes4> {87		reader.bytes4()88	}89}9091impl<T: AbiWrite> AbiWrite for &T {92	fn abi_write(&self, writer: &mut AbiWriter) {93		T::abi_write(self, writer);94	}95}9697impl<T: AbiType> AbiType for &T {98	const SIGNATURE: SignatureUnit = T::SIGNATURE;99100	fn is_dynamic() -> bool {101		T::is_dynamic()102	}103104	fn size() -> usize {105		T::size()106	}107}108109impl<T: AbiType + AbiRead + sealed::CanBePlacedInVec> AbiRead for Vec<T> {110	fn abi_read(reader: &mut AbiReader) -> Result<Vec<T>> {111		let mut sub = reader.subresult(None)?;112		let size = sub.uint32()? as usize;113		sub.subresult_offset = sub.offset;114		let is_dynamic = <T as AbiType>::is_dynamic();115		let mut out = Vec::with_capacity(size);116		for _ in 0..size {117			out.push(<T as AbiRead>::abi_read(&mut sub)?);118			if !is_dynamic {119				sub.bytes_read(<T as AbiType>::size());120			};121		}122		Ok(out)123	}124}125126impl<T: AbiType> AbiType for Vec<T> {127	const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));128129	fn is_dynamic() -> bool {130		true131	}132133	fn size() -> usize {134		ABI_ALIGNMENT135	}136}137138impl<T: AbiWrite + AbiType> AbiWrite for Vec<T> {139	fn abi_write(&self, writer: &mut AbiWriter) {140		let is_dynamic = T::is_dynamic();141		let mut sub = if is_dynamic {142			AbiWriter::new_dynamic(is_dynamic)143		} else {144			AbiWriter::new()145		};146147		// Write items count148		(self.len() as u32).abi_write(&mut sub);149150		for item in self {151			item.abi_write(&mut sub);152		}153		writer.write_subresult(sub);154	}155}156157impl AbiWrite for () {158	fn abi_write(&self, _writer: &mut AbiWriter) {}159}160161/// This particular AbiWrite implementation should be split to another trait,162/// which only implements `to_result`, but due to lack of specialization feature163/// in stable Rust, we can't have blanket impl of this trait `for T where T: AbiWrite`,164/// so here we abusing default trait methods for it165impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {166	fn abi_write(&self, _writer: &mut AbiWriter) {167		debug_assert!(false, "shouldn't be called, see comment")168	}169	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {170		match self {171			Ok(v) => Ok(WithPostDispatchInfo {172				post_info: v.post_info.clone(),173				data: {174					let mut out = AbiWriter::new();175					v.data.abi_write(&mut out);176					out177				},178			}),179			Err(e) => Err(e.clone()),180		}181	}182}183184macro_rules! impl_tuples {185	($($ident:ident)+) => {186		impl<$($ident: AbiType,)+> AbiType for ($($ident,)+)187		where188        $(189            $ident: AbiType,190        )+191		{192            const SIGNATURE: SignatureUnit = make_signature!(193                new fixed("(")194                $(nameof(<$ident>::SIGNATURE) fixed(","))+195                shift_left(1)196                fixed(")")197            );198199			fn is_dynamic() -> bool {200				false201				$(202					|| <$ident>::is_dynamic()203				)*204			}205206			fn size() -> usize {207				0 $(+ <$ident>::size())+208			}209		}210211		impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}212213		impl<$($ident),+> AbiRead for ($($ident,)+)214		where215			Self: AbiType,216			$($ident: AbiRead + AbiType,)+217		{218			fn abi_read(reader: &mut AbiReader) -> Result<($($ident,)+)> {219				let is_dynamic = <Self>::is_dynamic();220				let size = if !is_dynamic { Some(<Self>::size()) } else { None };221				let mut subresult = reader.subresult(size)?;222				Ok((223					$({224						let value = <$ident>::abi_read(&mut subresult)?;225						if !is_dynamic {subresult.bytes_read(<$ident as AbiType>::size())};226						value227					},)+228				))229			}230		}231232		#[allow(non_snake_case)]233		impl<$($ident),+> AbiWrite for ($($ident,)+)234		where235			$($ident: AbiWrite + AbiType,)+236		{237			fn abi_write(&self, writer: &mut AbiWriter) {238				let ($($ident,)+) = self;239				if <Self as AbiType>::is_dynamic() {240					let mut sub = AbiWriter::new();241					$($ident.abi_write(&mut sub);)+242					writer.write_subresult(sub);243				} else {244					$($ident.abi_write(writer);)+245				}246			}247		}248	};249}250251impl_tuples! {A}252impl_tuples! {A B}253impl_tuples! {A B C}254impl_tuples! {A B C D}255impl_tuples! {A B C D E}256impl_tuples! {A B C D E F}257impl_tuples! {A B C D E F G}258impl_tuples! {A B C D E F G H}259impl_tuples! {A B C D E F G H I}260impl_tuples! {A B C D E F G H I J}261262//----- impls for Option -----263impl<T: AbiType> AbiType for Option<T> {264	const SIGNATURE: SignatureUnit = <(bool, T)>::SIGNATURE;265266	fn is_dynamic() -> bool {267		<(bool, T)>::is_dynamic()268	}269270	fn size() -> usize {271		<(bool, T)>::size()272	}273}274275impl<T: AbiWrite + AbiType + Default> AbiWrite for Option<T> {276	fn abi_write(&self, writer: &mut AbiWriter) {277		match self {278			Some(value) => (true, value).abi_write(writer),279			None => (false, T::default()).abi_write(writer),280		}281	}282}283284impl<T> AbiRead for Option<T>285where286	Self: AbiType,287	T: AbiRead + AbiType,288{289	fn abi_read(reader: &mut AbiReader) -> Result<Self>290	where291		Self: Sized,292	{293		let (status, value) = <(bool, T)>::abi_read(reader)?;294		Ok(if status { Some(value) } else { None })295	}296}
after · 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)));1920			fn is_dynamic() -> bool {21				$dynamic22			}2324			fn size() -> usize {25				ABI_ALIGNMENT26			}27		}28	};29}3031macro_rules! impl_abi_readable {32	($ty:ty, $method:ident) => {33		impl AbiRead for $ty {34			fn abi_read(reader: &mut AbiReader) -> Result<$ty> {35				reader.$method()36			}37		}38	};39}4041macro_rules! impl_abi_writeable {42	($ty:ty, $method:ident) => {43		impl AbiWrite for $ty {44			fn abi_write(&self, writer: &mut AbiWriter) {45				writer.$method(&self)46			}47		}48	};49}5051macro_rules! impl_abi {52	($ty:ty, $method:ident, $dynamic:literal) => {53		impl_abi_type!($ty, $method, $dynamic);54		impl_abi_readable!($ty, $method);55		impl_abi_writeable!($ty, $method);56	};57}5859impl_abi!(bool, bool, false);60impl_abi!(u8, uint8, false);61impl_abi!(u32, uint32, false);62impl_abi!(u64, uint64, false);63impl_abi!(u128, uint128, false);64impl_abi!(U256, uint256, false);65impl_abi!(H160, address, false);66impl_abi!(String, string, true);6768impl_abi_writeable!(&str, string);6970impl_abi_type!(Bytes, bytes, true);7172impl AbiRead for Bytes {73	fn abi_read(reader: &mut AbiReader) -> Result<Bytes> {74		Ok(Bytes(reader.bytes()?))75	}76}7778impl AbiWrite for Bytes {79	fn abi_write(&self, writer: &mut AbiWriter) {80		writer.bytes(self.0.as_slice())81	}82}8384impl_abi_type!(Bytes4, bytes4, false);85impl AbiRead for Bytes4 {86	fn abi_read(reader: &mut AbiReader) -> Result<Bytes4> {87		reader.bytes4()88	}89}9091impl<T: AbiWrite> AbiWrite for &T {92	fn abi_write(&self, writer: &mut AbiWriter) {93		T::abi_write(self, writer);94	}95}9697impl<T: AbiType> AbiType for &T {98	const SIGNATURE: SignatureUnit = T::SIGNATURE;99100	fn is_dynamic() -> bool {101		T::is_dynamic()102	}103104	fn size() -> usize {105		T::size()106	}107}108109impl<T: AbiType + AbiRead + sealed::CanBePlacedInVec> AbiRead for Vec<T> {110	fn abi_read(reader: &mut AbiReader) -> Result<Vec<T>> {111		let mut sub = reader.subresult(None)?;112		let size = sub.uint32()? as usize;113		sub.subresult_offset = sub.offset;114		let is_dynamic = <T as AbiType>::is_dynamic();115		let mut out = Vec::with_capacity(size);116		for _ in 0..size {117			out.push(<T as AbiRead>::abi_read(&mut sub)?);118			if !is_dynamic {119				sub.bytes_read(<T as AbiType>::size());120			};121		}122		Ok(out)123	}124}125126impl<T: AbiType> AbiType for Vec<T> {127	const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));128129	fn is_dynamic() -> bool {130		true131	}132133	fn size() -> usize {134		ABI_ALIGNMENT135	}136}137138impl<T: AbiWrite + AbiType> AbiWrite for Vec<T> {139	fn abi_write(&self, writer: &mut AbiWriter) {140		let is_dynamic = T::is_dynamic();141		let mut sub = if is_dynamic {142			AbiWriter::new_dynamic(is_dynamic)143		} else {144			AbiWriter::new()145		};146147		// Write items count148		(self.len() as u32).abi_write(&mut sub);149150		for item in self {151			item.abi_write(&mut sub);152		}153		writer.write_subresult(sub);154	}155}156157impl AbiWrite for () {158	fn abi_write(&self, _writer: &mut AbiWriter) {}159}160161/// This particular AbiWrite implementation should be split to another trait,162/// which only implements `to_result`, but due to lack of specialization feature163/// in stable Rust, we can't have blanket impl of this trait `for T where T: AbiWrite`,164/// so here we abusing default trait methods for it165impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {166	fn abi_write(&self, _writer: &mut AbiWriter) {167		debug_assert!(false, "shouldn't be called, see comment")168	}169	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {170		match self {171			Ok(v) => Ok(WithPostDispatchInfo {172				post_info: v.post_info.clone(),173				data: {174					let mut out = AbiWriter::new();175					v.data.abi_write(&mut out);176					out177				},178			}),179			Err(e) => Err(e.clone()),180		}181	}182}183184macro_rules! impl_tuples {185	($($ident:ident)+) => {186		impl<$($ident: AbiType,)+> AbiType for ($($ident,)+)187		where188        $(189            $ident: AbiType,190        )+191		{192            const SIGNATURE: SignatureUnit = make_signature!(193                new fixed("(")194                $(nameof(<$ident>::SIGNATURE) fixed(","))+195                shift_left(1)196                fixed(")")197            );198199			fn is_dynamic() -> bool {200				false201				$(202					|| <$ident>::is_dynamic()203				)*204			}205206			fn size() -> usize {207				0 $(+ <$ident>::size())+208			}209		}210211		impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}212213		impl<$($ident),+> AbiRead for ($($ident,)+)214		where215			Self: AbiType,216			$($ident: AbiRead + AbiType,)+217		{218			fn abi_read(reader: &mut AbiReader) -> Result<($($ident,)+)> {219				let is_dynamic = <Self>::is_dynamic();220				let size = if !is_dynamic { Some(<Self>::size()) } else { None };221				let mut subresult = reader.subresult(size)?;222				Ok((223					$({224						let value = <$ident>::abi_read(&mut subresult)?;225						if !is_dynamic {subresult.bytes_read(<$ident as AbiType>::size())};226						value227					},)+228				))229			}230		}231232		#[allow(non_snake_case)]233		impl<$($ident),+> AbiWrite for ($($ident,)+)234		where235			$($ident: AbiWrite + AbiType,)+236		{237			fn abi_write(&self, writer: &mut AbiWriter) {238				let ($($ident,)+) = self;239				if <Self as AbiType>::is_dynamic() {240					let mut sub = AbiWriter::new();241					$($ident.abi_write(&mut sub);)+242					writer.write_subresult(sub);243				} else {244					$($ident.abi_write(writer);)+245				}246			}247		}248	};249}250251impl_tuples! {A}252impl_tuples! {A B}253impl_tuples! {A B C}254impl_tuples! {A B C D}255impl_tuples! {A B C D E}256impl_tuples! {A B C D E F}257impl_tuples! {A B C D E F G}258impl_tuples! {A B C D E F G H}259impl_tuples! {A B C D E F G H I}260impl_tuples! {A B C D E F G H I J}261262//----- impls for Option -----263impl<T: AbiType> AbiType for Option<T> {264	const SIGNATURE: SignatureUnit = <(bool, T)>::SIGNATURE;265266	fn is_dynamic() -> bool {267		<(bool, T)>::is_dynamic()268	}269270	fn size() -> usize {271		<(bool, T)>::size()272	}273}274275impl<T: AbiWrite + AbiType + Default> AbiWrite for Option<T> {276	fn abi_write(&self, writer: &mut AbiWriter) {277		match self {278			Some(value) => (true, value).abi_write(writer),279			None => (false, T::default()).abi_write(writer),280		}281	}282}283284impl<T> AbiRead for Option<T>285where286	Self: AbiType,287	T: AbiRead + AbiType,288{289	fn abi_read(reader: &mut AbiReader) -> Result<Self>290	where291		Self: Sized,292	{293		let (status, value) = <(bool, T)>::abi_read(reader)?;294		Ok(if status { Some(value) } else { None })295	}296}
modifiedcrates/evm-coder/src/abi/test.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi/test.rs
+++ b/crates/evm-coder/src/abi/test.rs
@@ -273,12 +273,12 @@
 
 #[test]
 fn encode_decode_vec_tuple_string_bytes() {
-	test_impl::<Vec<(String, bytes)>>(
+	test_impl::<Vec<(String, Bytes)>>(
 		0xdeadbeef,
 		vec![
 			(
 				"Test URI 0".to_string(),
-				bytes(vec![
+				Bytes(vec![
 					0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
 					0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
 					0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
@@ -287,14 +287,14 @@
 			),
 			(
 				"Test URI 1".to_string(),
-				bytes(vec![
+				Bytes(vec![
 					0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
 					0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
 					0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
 					0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
 				]),
 			),
-			("Test URI 2".to_string(), bytes(vec![0x33, 0x33])),
+			("Test URI 2".to_string(), Bytes(vec![0x33, 0x33])),
 		],
 		&hex!(
 			"
@@ -337,10 +337,10 @@
 // #[ignore = "reason"]
 fn encode_decode_tuple0_tuple1_uint8_tuple1_string_bytes_tuple1_uint8_bytes() {
 	let int = 0xff;
-	let by = bytes(vec![0x11, 0x22, 0x33]);
+	let by = Bytes(vec![0x11, 0x22, 0x33]);
 	let string = "some string".to_string();
 
-	test_impl::<((u8,), (String, bytes), (u8, bytes))>(
+	test_impl::<((u8,), (String, Bytes), (u8, Bytes))>(
 		0xdeadbeef,
 		((int,), (string.clone(), by.clone()), (int, by)),
 		&hex!(
@@ -485,9 +485,9 @@
 
 #[test]
 fn encode_decode_tuple0_tuple1_string_bytes() {
-	test_impl::<((String, bytes),)>(
+	test_impl::<((String, Bytes),)>(
 		0xdeadbeef,
-		(("some string".to_string(), bytes(vec![1, 2, 3])),),
+		(("some string".to_string(), Bytes(vec![1, 2, 3])),),
 		&hex!(
 			"
                 deadbeef
modifiedcrates/evm-coder/src/lib.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/lib.rs
+++ b/crates/evm-coder/src/lib.rs
@@ -141,7 +141,7 @@
 	pub type String = ::std::string::String;
 
 	#[derive(Default, Debug, PartialEq, Eq, Clone)]
-	pub struct bytes(pub Vec<u8>);
+	pub struct Bytes(pub Vec<u8>);
 
 	//#region Special types
 	/// Makes function payable
@@ -162,20 +162,20 @@
 		pub value: U256,
 	}
 
-	impl From<Vec<u8>> for bytes {
+	impl From<Vec<u8>> for Bytes {
 		fn from(src: Vec<u8>) -> Self {
 			Self(src)
 		}
 	}
 
 	#[allow(clippy::from_over_into)]
-	impl Into<Vec<u8>> for bytes {
+	impl Into<Vec<u8>> for Bytes {
 		fn into(self) -> Vec<u8> {
 			self.0
 		}
 	}
 
-	impl bytes {
+	impl Bytes {
 		#[must_use]
 		pub fn len(&self) -> usize {
 			self.0.len()
modifiedcrates/evm-coder/src/solidity/impls.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/solidity/impls.rs
+++ b/crates/evm-coder/src/solidity/impls.rs
@@ -30,7 +30,7 @@
 	Bytes4 => "bytes4" true = "bytes4(0)",
 	H160 => "address" true = "0x0000000000000000000000000000000000000000",
 	String => "string" false = "\"\"",
-	bytes => "bytes" false = "hex\"\"",
+	Bytes => "bytes" false = "hex\"\"",
 	bool => "bool" true = "false",
 }
 
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
@@ -1,6 +1,6 @@
 mod test_struct {
 	use evm_coder_procedural::AbiCoder;
-	use evm_coder::types::bytes;
+	use evm_coder::types::Bytes;
 
 	#[test]
 	fn empty_struct() {
@@ -27,13 +27,13 @@
 	#[derive(AbiCoder, PartialEq, Debug)]
 	struct TypeStruct2DynamicParam {
 		_a: String,
-		_b: bytes,
+		_b: Bytes,
 	}
 
 	#[derive(AbiCoder, PartialEq, Debug)]
 	struct TypeStruct2MixedParam {
 		_a: u8,
-		_b: bytes,
+		_b: Bytes,
 	}
 
 	#[derive(AbiCoder, PartialEq, Debug)]
@@ -236,10 +236,10 @@
 	struct TupleStruct2SimpleParam(u8, u32);
 
 	#[derive(AbiCoder, PartialEq, Debug)]
-	struct TupleStruct2DynamicParam(String, bytes);
+	struct TupleStruct2DynamicParam(String, Bytes);
 
 	#[derive(AbiCoder, PartialEq, Debug)]
-	struct TupleStruct2MixedParam(u8, bytes);
+	struct TupleStruct2MixedParam(u8, Bytes);
 
 	#[derive(AbiCoder, PartialEq, Debug)]
 	struct TupleStruct1DerivedSimpleParam(TupleStruct1SimpleParam);
@@ -562,8 +562,8 @@
 	#[test]
 	fn codec_struct_2_dynamic() {
 		let _a: String = "some string".into();
-		let _b: bytes = bytes(vec![0x11, 0x22, 0x33]);
-		test_impl::<(String, bytes), TupleStruct2DynamicParam, TypeStruct2DynamicParam>(
+		let _b: Bytes = Bytes(vec![0x11, 0x22, 0x33]);
+		test_impl::<(String, Bytes), TupleStruct2DynamicParam, TypeStruct2DynamicParam>(
 			(_a.clone(), _b.clone()),
 			TupleStruct2DynamicParam(_a.clone(), _b.clone()),
 			TypeStruct2DynamicParam { _a, _b },
@@ -573,8 +573,8 @@
 	#[test]
 	fn codec_struct_2_mixed() {
 		let _a: u8 = 0xff;
-		let _b: bytes = bytes(vec![0x11, 0x22, 0x33]);
-		test_impl::<(u8, bytes), TupleStruct2MixedParam, TypeStruct2MixedParam>(
+		let _b: Bytes = Bytes(vec![0x11, 0x22, 0x33]);
+		test_impl::<(u8, Bytes), TupleStruct2MixedParam, TypeStruct2MixedParam>(
 			(_a.clone(), _b.clone()),
 			TupleStruct2MixedParam(_a.clone(), _b.clone()),
 			TypeStruct2MixedParam { _a, _b },
@@ -605,9 +605,9 @@
 	#[test]
 	fn codec_struct_2_derived_dynamic() {
 		let _a = "some string".to_string();
-		let _b = bytes(vec![0x11, 0x22, 0x33]);
+		let _b = Bytes(vec![0x11, 0x22, 0x33]);
 		test_impl::<
-			((String,), (String, bytes)),
+			((String,), (String, Bytes)),
 			TupleStruct2DerivedDynamicParam,
 			TypeStruct2DerivedDynamicParam,
 		>(
@@ -626,10 +626,10 @@
 	#[test]
 	fn codec_struct_3_derived_mixed() {
 		let int = 0xff;
-		let by = bytes(vec![0x11, 0x22, 0x33]);
+		let by = Bytes(vec![0x11, 0x22, 0x33]);
 		let string = "some string".to_string();
 		test_impl::<
-			((u8,), (String, bytes), (u8, bytes)),
+			((u8,), (String, Bytes), (u8, Bytes)),
 			TupleStruct3DerivedMixedParam,
 			TypeStruct3DerivedMixedParam,
 		>(
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -94,7 +94,7 @@
 	/// @param value Propery value.
 	#[solidity(hide)]
 	#[weight(<SelfWeightOf<T>>::set_collection_properties(1))]
-	fn set_collection_property(&mut self, caller: caller, key: String, value: bytes) -> Result<()> {
+	fn set_collection_property(&mut self, caller: caller, key: String, value: Bytes) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let key = <Vec<u8>>::from(key)
 			.try_into()
@@ -164,7 +164,7 @@
 	///
 	/// @param key Property key.
 	/// @return bytes The property corresponding to the key.
-	fn collection_property(&self, key: String) -> Result<bytes> {
+	fn collection_property(&self, key: String) -> Result<Bytes> {
 		let key = <Vec<u8>>::from(key)
 			.try_into()
 			.map_err(|_| "key too large")?;
@@ -172,7 +172,7 @@
 		let props = CollectionProperties::<T>::get(self.id);
 		let prop = props.get(&key).ok_or("key not found")?;
 
-		Ok(bytes(prop.to_vec()))
+		Ok(Bytes(prop.to_vec()))
 	}
 
 	/// Get collection properties.
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -119,7 +119,7 @@
 #[derive(Debug, Default, AbiCoder)]
 pub struct Property {
 	key: evm_coder::types::String,
-	value: evm_coder::types::bytes,
+	value: evm_coder::types::Bytes,
 }
 
 impl TryFrom<up_data_structs::Property> for Property {
@@ -128,7 +128,7 @@
 	fn try_from(from: up_data_structs::Property) -> Result<Self, Self::Error> {
 		let key = evm_coder::types::String::from_utf8(from.key.into())
 			.map_err(|e| Self::Error::Revert(format!("utf8 conversion error: {}", e)))?;
-		let value = evm_coder::types::bytes(from.value.to_vec());
+		let value = evm_coder::types::Bytes(from.value.to_vec());
 		Ok(Property { key, value })
 	}
 }
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -124,7 +124,7 @@
 		caller: caller,
 		token_id: U256,
 		key: String,
-		value: bytes,
+		value: Bytes,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -239,7 +239,7 @@
 	/// @param tokenId ID of the token.
 	/// @param key Property key.
 	/// @return Property value bytes
-	fn property(&self, token_id: U256, key: String) -> Result<bytes> {
+	fn property(&self, token_id: U256, key: String) -> Result<Bytes> {
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
 		let key = <Vec<u8>>::from(key)
 			.try_into()
@@ -422,7 +422,7 @@
 		_from: Address,
 		_to: Address,
 		_token_id: U256,
-		_data: bytes,
+		_data: Bytes,
 	) -> Result<()> {
 		// TODO: Not implemetable
 		Err("not implemented".into())
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -127,7 +127,7 @@
 		caller: caller,
 		token_id: U256,
 		key: String,
-		value: bytes,
+		value: Bytes,
 	) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -242,7 +242,7 @@
 	/// @param tokenId ID of the token.
 	/// @param key Property key.
 	/// @return Property value bytes
-	fn property(&self, token_id: U256, key: String) -> Result<bytes> {
+	fn property(&self, token_id: U256, key: String) -> Result<Bytes> {
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
 		let key = <Vec<u8>>::from(key)
 			.try_into()
@@ -423,7 +423,7 @@
 		_from: Address,
 		_to: Address,
 		_token_id: U256,
-		_data: bytes,
+		_data: Bytes,
 	) -> Result<()> {
 		// TODO: Not implemetable
 		Err("not implemented".into())