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
19use evm_coder::{19use evm_coder::{
20 abi::AbiType, ToLog, execution::Result, solidity_interface, types::*, solidity, weight,20 abi::AbiType, ToLog, execution::Result, solidity_interface, types::*, solidity, weight,
21};21};
22use primitive_types::U256;
2223
23pub struct Impls;24pub struct Impls;
2425
25#[solidity_interface(name = OurInterface)]26#[solidity_interface(name = OurInterface)]
26impl Impls {27impl Impls {
27 fn fn_a(&self, _input: uint256) -> Result<bool> {28 fn fn_a(&self, _input: U256) -> Result<bool> {
28 unreachable!()29 unreachable!()
29 }30 }
30}31}
3132
32#[solidity_interface(name = OurInterface1)]33#[solidity_interface(name = OurInterface1)]
33impl Impls {34impl Impls {
34 fn fn_b(&self, _input: uint128) -> Result<uint32> {35 fn fn_b(&self, _input: u128) -> Result<u32> {
35 unreachable!()36 unreachable!()
36 }37 }
37}38}
3839
39#[derive(ToLog)]40#[derive(ToLog)]
40enum OurEvents {41enum OurEvents {
41 Event1 {42 Event1 {
42 field1: uint32,43 field1: u32,
43 },44 },
44 Event2 {45 Event2 {
45 field1: uint32,46 field1: u32,
46 #[indexed]47 #[indexed]
47 field2: uint32,48 field2: u32,
48 },49 },
49}50}
5051
56)]57)]
57impl Impls {58impl Impls {
58 #[solidity(rename_selector = "fnK")]59 #[solidity(rename_selector = "fnK")]
59 fn fn_c(&self, _input: uint32) -> Result<uint8> {60 fn fn_c(&self, _input: u32) -> Result<u8> {
60 unreachable!()61 unreachable!()
61 }62 }
62 fn fn_d(&self, _value: uint32) -> Result<uint32> {63 fn fn_d(&self, _value: u32) -> Result<u32> {
63 unreachable!()64 unreachable!()
64 }65 }
6566
66 fn caller_sensitive(&self, _caller: caller) -> Result<uint8> {67 fn caller_sensitive(&self, _caller: caller) -> Result<u8> {
67 unreachable!()68 unreachable!()
68 }69 }
69 fn payable(&mut self, _value: value) -> Result<uint8> {70 fn payable(&mut self, _value: value) -> Result<u8> {
70 unreachable!()71 unreachable!()
71 }72 }
7273
73 #[weight(*_weight)]74 #[weight(*_weight)]
74 fn with_weight(&self, _weight: uint64) -> Result<void> {75 fn with_weight(&self, _weight: u64) -> Result<()> {
75 unreachable!()76 unreachable!()
76 }77 }
7778
78 /// Doccoment example79 /// Doccoment example
79 fn with_doc(&self) -> Result<void> {80 fn with_doc(&self) -> Result<()> {
80 unreachable!()81 unreachable!()
81 }82 }
82}83}
modifiedcrates/evm-coder/tests/solidity_generation.rsdiffbeforeafterboth
--- a/crates/evm-coder/tests/solidity_generation.rs
+++ b/crates/evm-coder/tests/solidity_generation.rs
@@ -15,19 +15,20 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use evm_coder::{abi::AbiType, execution::Result, generate_stubgen, solidity_interface, types::*};
+use primitive_types::U256;
 
 pub struct ERC20;
 
 #[solidity_interface(name = ERC20)]
 impl ERC20 {
-	fn decimals(&self) -> Result<uint8> {
+	fn decimals(&self) -> Result<u8> {
 		unreachable!()
 	}
 	/// Get balance of specified owner
-	fn balance_of(&self, _owner: address) -> Result<uint256> {
+	fn balance_of(&self, _owner: address) -> Result<U256> {
 		unreachable!()
 	}
-	fn transfer(&mut self, _caller: caller, _to: address, _value: uint256) -> Result<bool> {
+	fn transfer(&mut self, _caller: caller, _to: address, _value: U256) -> Result<bool> {
 		unreachable!()
 	}
 	fn transfer_from(
@@ -35,14 +36,14 @@
 		_caller: caller,
 		_from: address,
 		_to: address,
-		_value: uint256,
+		_value: U256,
 	) -> Result<bool> {
 		unreachable!()
 	}
-	fn approve(&mut self, _caller: caller, _spender: address, _value: uint256) -> Result<bool> {
+	fn approve(&mut self, _caller: caller, _spender: address, _value: U256) -> Result<bool> {
 		unreachable!()
 	}
-	fn allowance(&self, _owner: address, _spender: address) -> Result<uint256> {
+	fn allowance(&self, _owner: address, _spender: address) -> Result<U256> {
 		unreachable!()
 	}
 }