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

difftreelog

fix unit tests

Trubnikov Sergey2023-01-17parent: #c33e413.patch.diff
in: master

6 files changed

modifiedcrates/evm-coder/src/abi/test.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi/test.rs
+++ b/crates/evm-coder/src/abi/test.rs
@@ -39,22 +39,22 @@
 
 #[test]
 fn encode_decode_uint8() {
-	test_impl_uint!(uint8);
+	test_impl_uint!(u8);
 }
 
 #[test]
 fn encode_decode_uint32() {
-	test_impl_uint!(uint32);
+	test_impl_uint!(u32);
 }
 
 #[test]
 fn encode_decode_uint128() {
-	test_impl_uint!(uint128);
+	test_impl_uint!(u128);
 }
 
 #[test]
 fn encode_decode_uint256() {
-	test_impl::<uint256>(
+	test_impl::<U256>(
 		0xdeadbeef,
 		U256([255, 0, 0, 0]),
 		&hex!(
@@ -101,7 +101,7 @@
 
 #[test]
 fn encode_decode_vec_tuple_address_uint256() {
-	test_impl::<Vec<(address, uint256)>>(
+	test_impl::<Vec<(address, U256)>>(
         0x1ACF2D55,
         vec![
             (
@@ -138,7 +138,7 @@
 
 #[test]
 fn encode_decode_vec_tuple_uint256_string() {
-	test_impl::<Vec<(uint256, string)>>(
+	test_impl::<Vec<(U256, string)>>(
         0xdeadbeef,
         vec![
             (1.into(), "Test URI 0".to_string()),
@@ -261,7 +261,7 @@
 	let (call, mut decoder) = AbiReader::new_call(encoded_data).unwrap();
 	assert_eq!(call, u32::to_be_bytes(decoded_data.0));
 	let address = decoder.address().unwrap();
-	let data = <Vec<(uint256, string)>>::abi_read(&mut decoder).unwrap();
+	let data = <Vec<(U256, string)>>::abi_read(&mut decoder).unwrap();
 	assert_eq!(data, decoded_data.1);
 
 	let mut writer = AbiWriter::new_call(decoded_data.0);
modifiedcrates/evm-coder/tests/conditional_is.rsdiffbeforeafterboth
--- a/crates/evm-coder/tests/conditional_is.rs
+++ b/crates/evm-coder/tests/conditional_is.rs
@@ -4,14 +4,14 @@
 
 #[solidity_interface(name = A)]
 impl Contract {
-	fn method_a() -> Result<void> {
+	fn method_a() -> Result<()> {
 		Ok(())
 	}
 }
 
 #[solidity_interface(name = B)]
 impl Contract {
-	fn method_b() -> Result<void> {
+	fn method_b() -> Result<()> {
 		Ok(())
 	}
 }
modifiedcrates/evm-coder/tests/generics.rsdiffbeforeafterboth
--- a/crates/evm-coder/tests/generics.rs
+++ b/crates/evm-coder/tests/generics.rs
@@ -16,19 +16,20 @@
 
 use std::marker::PhantomData;
 use evm_coder::{execution::Result, generate_stubgen, solidity_interface, types::*};
+use primitive_types::U256;
 
 pub struct Generic<T>(PhantomData<T>);
 
 #[solidity_interface(name = GenericIs)]
 impl<T> Generic<T> {
-	fn test_1(&self) -> Result<uint256> {
+	fn test_1(&self) -> Result<U256> {
 		unreachable!()
 	}
 }
 
 #[solidity_interface(name = Generic, is(GenericIs))]
 impl<T: Into<u32>> Generic<T> {
-	fn test_2(&self) -> Result<uint256> {
+	fn test_2(&self) -> Result<U256> {
 		unreachable!()
 	}
 }
@@ -40,7 +41,7 @@
 where
 	T: core::fmt::Debug,
 {
-	fn test_3(&self) -> Result<uint256> {
+	fn test_3(&self) -> Result<U256> {
 		unreachable!()
 	}
 }
modifiedcrates/evm-coder/tests/log.rsdiffbeforeafterboth
--- a/crates/evm-coder/tests/log.rs
+++ b/crates/evm-coder/tests/log.rs
@@ -17,6 +17,7 @@
 #![allow(dead_code)]
 
 use evm_coder::{ToLog, types::*};
+use primitive_types::U256;
 
 #[derive(ToLog)]
 enum ERC721Log {
@@ -25,11 +26,11 @@
 		from: address,
 		#[indexed]
 		to: address,
-		value: uint256,
+		value: U256,
 	},
 	Eee {
 		#[indexed]
 		aaa: address,
-		bbb: uint256,
+		bbb: U256,
 	},
 }
modifiedcrates/evm-coder/tests/random.rsdiffbeforeafterboth
--- a/crates/evm-coder/tests/random.rs
+++ b/crates/evm-coder/tests/random.rs
@@ -19,19 +19,20 @@
 use evm_coder::{
 	abi::AbiType, ToLog, execution::Result, solidity_interface, types::*, solidity, weight,
 };
+use primitive_types::U256;
 
 pub struct Impls;
 
 #[solidity_interface(name = OurInterface)]
 impl Impls {
-	fn fn_a(&self, _input: uint256) -> Result<bool> {
+	fn fn_a(&self, _input: U256) -> Result<bool> {
 		unreachable!()
 	}
 }
 
 #[solidity_interface(name = OurInterface1)]
 impl Impls {
-	fn fn_b(&self, _input: uint128) -> Result<uint32> {
+	fn fn_b(&self, _input: u128) -> Result<u32> {
 		unreachable!()
 	}
 }
@@ -39,12 +40,12 @@
 #[derive(ToLog)]
 enum OurEvents {
 	Event1 {
-		field1: uint32,
+		field1: u32,
 	},
 	Event2 {
-		field1: uint32,
+		field1: u32,
 		#[indexed]
-		field2: uint32,
+		field2: u32,
 	},
 }
 
@@ -56,27 +57,27 @@
 )]
 impl Impls {
 	#[solidity(rename_selector = "fnK")]
-	fn fn_c(&self, _input: uint32) -> Result<uint8> {
+	fn fn_c(&self, _input: u32) -> Result<u8> {
 		unreachable!()
 	}
-	fn fn_d(&self, _value: uint32) -> Result<uint32> {
+	fn fn_d(&self, _value: u32) -> Result<u32> {
 		unreachable!()
 	}
 
-	fn caller_sensitive(&self, _caller: caller) -> Result<uint8> {
+	fn caller_sensitive(&self, _caller: caller) -> Result<u8> {
 		unreachable!()
 	}
-	fn payable(&mut self, _value: value) -> Result<uint8> {
+	fn payable(&mut self, _value: value) -> Result<u8> {
 		unreachable!()
 	}
 
 	#[weight(*_weight)]
-	fn with_weight(&self, _weight: uint64) -> Result<void> {
+	fn with_weight(&self, _weight: u64) -> Result<()> {
 		unreachable!()
 	}
 
 	/// Doccoment example
-	fn with_doc(&self) -> Result<void> {
+	fn with_doc(&self) -> Result<()> {
 		unreachable!()
 	}
 }
modifiedcrates/evm-coder/tests/solidity_generation.rsdiffbeforeafterboth
before · crates/evm-coder/tests/solidity_generation.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use evm_coder::{abi::AbiType, execution::Result, generate_stubgen, solidity_interface, types::*};1819pub struct ERC20;2021#[solidity_interface(name = ERC20)]22impl ERC20 {23	fn decimals(&self) -> Result<uint8> {24		unreachable!()25	}26	/// Get balance of specified owner27	fn balance_of(&self, _owner: address) -> Result<uint256> {28		unreachable!()29	}30	fn transfer(&mut self, _caller: caller, _to: address, _value: uint256) -> Result<bool> {31		unreachable!()32	}33	fn transfer_from(34		&mut self,35		_caller: caller,36		_from: address,37		_to: address,38		_value: uint256,39	) -> Result<bool> {40		unreachable!()41	}42	fn approve(&mut self, _caller: caller, _spender: address, _value: uint256) -> Result<bool> {43		unreachable!()44	}45	fn allowance(&self, _owner: address, _spender: address) -> Result<uint256> {46		unreachable!()47	}48}4950generate_stubgen!(gen_impl, ERC20Call, true);51generate_stubgen!(gen_iface, ERC20Call, false);
after · crates/evm-coder/tests/solidity_generation.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use evm_coder::{abi::AbiType, execution::Result, generate_stubgen, solidity_interface, types::*};18use primitive_types::U256;1920pub struct ERC20;2122#[solidity_interface(name = ERC20)]23impl ERC20 {24	fn decimals(&self) -> Result<u8> {25		unreachable!()26	}27	/// Get balance of specified owner28	fn balance_of(&self, _owner: address) -> Result<U256> {29		unreachable!()30	}31	fn transfer(&mut self, _caller: caller, _to: address, _value: U256) -> Result<bool> {32		unreachable!()33	}34	fn transfer_from(35		&mut self,36		_caller: caller,37		_from: address,38		_to: address,39		_value: U256,40	) -> Result<bool> {41		unreachable!()42	}43	fn approve(&mut self, _caller: caller, _spender: address, _value: U256) -> Result<bool> {44		unreachable!()45	}46	fn allowance(&self, _owner: address, _spender: address) -> Result<U256> {47		unreachable!()48	}49}5051generate_stubgen!(gen_impl, ERC20Call, true);52generate_stubgen!(gen_iface, ERC20Call, false);