git.delta.rocks / unique-network / refs/commits / 2ef175a77541

difftreelog

fix remove warning

Trubnikov Sergey2022-10-31parent: #90b12da.patch.diff
in: master

2 files changed

modifiedcrates/evm-coder/procedural/src/solidity_interface.rsdiffbeforeafterboth
731 let selector_str = &self.selector_str;731 let selector_str = &self.selector_str;
732 let custom_signature = self.expand_custom_signature();732 let custom_signature = self.expand_custom_signature();
733 quote! {733 quote! {
734 #[doc = #selector_str]
734 const #screaming_name_signature: ::evm_coder::custom_signature::FunctionSignature = #custom_signature;735 const #screaming_name_signature: ::evm_coder::custom_signature::FunctionSignature = #custom_signature;
735 #[doc = #selector_str]
736 const #screaming_name: ::evm_coder::types::bytes4 = {736 const #screaming_name: ::evm_coder::types::bytes4 = {
737 let mut data = [0_u8; Self::#screaming_name_signature.unit.len];737 let mut sum = ::evm_coder::sha3_const::Keccak256::new();
738 let mut pos = 0;738 let mut pos = 0;
739 while pos < Self::#screaming_name_signature.unit.len {739 while pos < Self::#screaming_name_signature.unit.len {
740 data[pos] = Self::#screaming_name_signature.unit.data[pos];740 sum = sum.update(&[Self::#screaming_name_signature.unit.data[pos]; 1]);
741 pos += 1;741 pos += 1;
742 }742 }
743 let a = ::evm_coder::sha3_const::Keccak256::new()743 let a = sum.finalize();
744 .update(&data)
745 .finalize();
746 [a[0], a[1], a[2], a[3]]744 [a[0], a[1], a[2], a[3]]
747 };745 };
11341132
1135 let docs = &self.docs;1133 let docs = &self.docs;
1136
1137 if let Some(expect_selector) = &self.info.expect_selector {
1138 if !self.info.inline_is.0.is_empty() {
1139 return syn::Error::new(
1140 name.span(),
1141 "expect_selector is not compatible with inline_is",
1142 )
1143 .to_compile_error();
1144 }
1145 let selector = self
1146 .methods
1147 .iter()
1148 .map(|m| m.selector)
1149 .fold(0, |a, b| a ^ b);
1150
1151 if *expect_selector != selector {
1152 let mut methods = String::new();
1153 for meth in self.methods.iter() {
1154 write!(methods, "\n- {}", meth.selector_str).expect("write to string");
1155 }
1156 return syn::Error::new(name.span(), format!("expected selector mismatch, expected {expect_selector:0>8x}, but implementation has {selector:0>8x}{methods}")).to_compile_error();
1157 }
1158 }
1159 // let methods = self.methods.iter().map(Method::solidity_def);
11601134
1161 quote! {1135 quote! {
1162 #[derive(Debug)]1136 #[derive(Debug)]
modifiedcrates/evm-coder/src/custom_signature.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/custom_signature.rs
+++ b/crates/evm-coder/src/custom_signature.rs
@@ -241,7 +241,7 @@
 /// ```
 #[macro_export]
 macro_rules! make_signature {
-	(new fn($func:expr)$(,)+) => {
+	(new fn($func:expr)$(,)*) => {
 		{
 			let fs = FunctionSignature::new($func);
 			let fs = FunctionSignature::done(fs, false);
@@ -426,7 +426,7 @@
 	#[test]
 	fn make_func_without_args() {
 		const SIG: FunctionSignature = make_signature!(
-			new fn(SIGNATURE_PREFERENCES),
+			new fn(SIGNATURE_PREFERENCES)
 		);
 		let name = SIG.as_str();
 		similar_asserts::assert_eq!(name, "some_funk()");