difftreelog
refactor decouple make_signature from constant itself
in: master
9 files changed
crates/evm-coder/procedural/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder/procedural/src/solidity_interface.rs
+++ b/crates/evm-coder/procedural/src/solidity_interface.rs
@@ -721,7 +721,7 @@
for arg in self.args.iter().filter(|a| !a.is_special()) {
has_params = true;
let ty = &arg.ty;
- args.extend(quote! {nameof(#ty)});
+ args.extend(quote! {nameof(<#ty>::SIGNATURE)});
args.extend(quote! {fixed(",")})
}
crates/evm-coder/src/abi.rsdiffbeforeafterboth--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -428,7 +428,7 @@
}
impl<R: Signature> Signature for Vec<R> {
- const SIGNATURE: SignatureUnit = make_signature!(new nameof(R) fixed("[]"));
+ const SIGNATURE: SignatureUnit = make_signature!(new nameof(R::SIGNATURE) fixed("[]"));
}
impl sealed::CanBePlacedInVec for EthCrossAccount {}
@@ -524,7 +524,7 @@
{
const SIGNATURE: SignatureUnit = make_signature!(
new fixed("(")
- $(nameof($ident) fixed(","))+
+ $(nameof(<$ident>::SIGNATURE) fixed(","))+
shift_left(1)
fixed(")")
);
crates/evm-coder/src/custom_signature.rsdiffbeforeafterboth1//! # A module for custom signature support.2//!3//! ## Overview4//! This module allows you to create arbitrary signatures for types and functions in compile time.5//!6//! ### Type signatures7//! To create the desired type signature, you need to create your own trait with the `SIGNATURE` constant.8//! Then in the implementation, for the required type, use the macro [`make_signature`]9//! #### Example10//! ```11//! use std::str::from_utf8;12//! use evm_coder::make_signature;13//! use evm_coder::custom_signature::{14//! SignatureUnit,15//! SIGNATURE_SIZE_LIMIT16//! };17//!18//! // Create trait for our signature19//! trait SoliditySignature {20//! const SIGNATURE: SignatureUnit;21//!22//! fn name() -> &'static str {23//! from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")24//! }25//! }26//!27//! // Make signatures for some types28//! impl SoliditySignature for u8 {29//! make_signature!(new fixed("uint8"));30//! }31//! impl SoliditySignature for u32 {32//! make_signature!(new fixed("uint32"));33//! }34//! impl<T: SoliditySignature> SoliditySignature for Vec<T> {35//! make_signature!(new nameof(T) fixed("[]"));36//! }37//! impl<A: SoliditySignature, B: SoliditySignature> SoliditySignature for (A, B) {38//! make_signature!(new fixed("(") nameof(A) fixed(",") nameof(B) fixed(")"));39//! }40//! impl<A: SoliditySignature> SoliditySignature for (A,) {41//! make_signature!(new fixed("(") nameof(A) fixed(",") shift_left(1) fixed(")"));42//! }43//!44//! assert_eq!(u8::name(), "uint8");45//! assert_eq!(<Vec<u8>>::name(), "uint8[]");46//! assert_eq!(<(u32, u8)>::name(), "(uint32,uint8)");47//! ```48//!49//! ### Function signatures50//! To create a function signature, the macro [`make_signature`] is also used, which accepts51//! settings for the function format [`SignaturePreferences`] and function parameters [`SignatureUnit`]52//! #### Example53//! ```54//! use core::str::from_utf8;55//! use evm_coder::{56//! make_signature,57//! custom_signature::{58//! SIGNATURE_SIZE_LIMIT, SignatureUnit, SignaturePreferences, FunctionSignature,59//! },60//! };61//! // Trait for our signature62//! trait SoliditySignature {63//! const SIGNATURE: SignatureUnit;64//!65//! fn name() -> &'static str {66//! from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")67//! }68//! }69//!70//! // Make signatures for some types71//! impl SoliditySignature for u8 {72//! make_signature!(new fixed("uint8"));73//! }74//! impl<T: SoliditySignature> SoliditySignature for Vec<T> {75//! make_signature!(new nameof(T) fixed("[]"));76//! }77//! ```7879/// The maximum length of the signature.80pub const SIGNATURE_SIZE_LIMIT: usize = 256;8182/// Storage for the signature or its elements.83#[derive(Debug)]84pub struct SignatureUnit {85 /// Signature data.86 pub data: [u8; SIGNATURE_SIZE_LIMIT],87 /// The actual size of the data.88 pub len: usize,89}9091impl SignatureUnit {92 /// Create a signature from `&str'.93 pub const fn new(name: &'static str) -> SignatureUnit {94 let mut signature = [0_u8; SIGNATURE_SIZE_LIMIT];95 let name = name.as_bytes();96 let name_len = name.len();97 let mut dst_offset = 0;98 crate::make_signature!(@copy(name, signature, name_len, dst_offset));99 SignatureUnit {100 data: signature,101 len: name_len,102 }103 }104 /// String conversion105 pub fn as_str(&self) -> Option<&str> {106 core::str::from_utf8(&self.data[0..self.len]).ok()107 }108}109110/// ### Macro to create signatures of types and functions.111///112/// Format for creating a type of signature:113/// ```ignore114/// make_signature!(new fixed("uint8")); // Simple type115/// make_signature!(new fixed("(") nameof(u8) fixed(",") nameof(u8) fixed(")")); // Composite type116/// ```117#[macro_export]118macro_rules! make_signature {119 (new $($tt:tt)*) => {120 ($crate::custom_signature::SignatureUnit {121 data: {122 let mut out = [0u8; $crate::custom_signature::SIGNATURE_SIZE_LIMIT];123 let mut dst_offset = 0;124 $crate::make_signature!(@data(out, dst_offset); $($tt)*);125 out126 },127 len: {0 + $crate::make_signature!(@size; $($tt)*)},128 })129 };130131 (@size;) => {132 0133 };134 (@size; fixed($expr:expr) $($tt:tt)*) => {135 $expr.len() + $crate::make_signature!(@size; $($tt)*)136 };137 (@size; nameof($expr:ty) $($tt:tt)*) => {138 <$expr>::SIGNATURE.len + $crate::make_signature!(@size; $($tt)*)139 };140 (@size; shift_left($expr:expr) $($tt:tt)*) => {141 $crate::make_signature!(@size; $($tt)*) - $expr142 };143144 (@data($dst:ident, $dst_offset:ident);) => {};145 (@data($dst:ident, $dst_offset:ident); fixed($expr:expr) $($tt:tt)*) => {146 {147 let data = $expr.as_bytes();148 let data_len = data.len();149 $crate::make_signature!(@copy(data, $dst, data_len, $dst_offset));150 }151 $crate::make_signature!(@data($dst, $dst_offset); $($tt)*)152 };153 (@data($dst:ident, $dst_offset:ident); nameof($expr:ty) $($tt:tt)*) => {154 {155 $crate::make_signature!(@copy(&<$expr>::SIGNATURE.data, $dst, <$expr>::SIGNATURE.len, $dst_offset));156 }157 $crate::make_signature!(@data($dst, $dst_offset); $($tt)*)158 };159 (@data($dst:ident, $dst_offset:ident); shift_left($expr:expr) $($tt:tt)*) => {160 $dst_offset -= $expr;161 $crate::make_signature!(@data($dst, $dst_offset); $($tt)*)162 };163164 (@copy($src:expr, $dst:expr, $src_len:expr, $dst_offset:ident)) => {165 {166 let mut src_offset = 0;167 let src_len: usize = $src_len;168 while src_offset < src_len {169 $dst[$dst_offset] = $src[src_offset];170 $dst_offset += 1;171 src_offset += 1;172 }173 }174 }175}176177#[cfg(test)]178mod test {179 use core::str::from_utf8;180181 use super::{SIGNATURE_SIZE_LIMIT, SignatureUnit};182183 trait Name {184 const SIGNATURE: SignatureUnit;185186 fn name() -> &'static str {187 from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")188 }189 }190191 impl Name for u8 {192 const SIGNATURE: SignatureUnit = make_signature!(new fixed("uint8"));193 }194 impl Name for u32 {195 const SIGNATURE: SignatureUnit = make_signature!(new fixed("uint32"));196 }197 impl<T: Name> Name for Vec<T> {198 const SIGNATURE: SignatureUnit = make_signature!(new nameof(T) fixed("[]"));199 }200 impl<A: Name, B: Name> Name for (A, B) {201 const SIGNATURE: SignatureUnit =202 make_signature!(new fixed("(") nameof(A) fixed(",") nameof(B) fixed(")"));203 }204 impl<A: Name> Name for (A,) {205 const SIGNATURE: SignatureUnit =206 make_signature!(new fixed("(") nameof(A) fixed(",") shift_left(1) fixed(")"));207 }208209 struct MaxSize();210 impl Name for MaxSize {211 const SIGNATURE: SignatureUnit = SignatureUnit {212 data: [b'!'; SIGNATURE_SIZE_LIMIT],213 len: SIGNATURE_SIZE_LIMIT,214 };215 }216217 #[test]218 fn simple() {219 assert_eq!(u8::name(), "uint8");220 assert_eq!(u32::name(), "uint32");221 }222223 #[test]224 fn vector_of_simple() {225 assert_eq!(<Vec<u8>>::name(), "uint8[]");226 assert_eq!(<Vec<u32>>::name(), "uint32[]");227 }228229 #[test]230 fn vector_of_vector() {231 assert_eq!(<Vec<Vec<u8>>>::name(), "uint8[][]");232 }233234 #[test]235 fn tuple_of_simple() {236 assert_eq!(<(u32, u8)>::name(), "(uint32,uint8)");237 }238239 #[test]240 fn tuple_of_tuple() {241 assert_eq!(242 <((u32, u8), (u8, u32))>::name(),243 "((uint32,uint8),(uint8,uint32))"244 );245 }246247 #[test]248 fn vector_of_tuple() {249 assert_eq!(<Vec<(u32, u8)>>::name(), "(uint32,uint8)[]");250 }251252 #[test]253 fn tuple_of_vector() {254 assert_eq!(<(Vec<u32>, u8)>::name(), "(uint32[],uint8)");255 }256257 #[test]258 fn complex() {259 assert_eq!(260 <(Vec<u32>, (u32, Vec<u8>))>::name(),261 "(uint32[],(uint32,uint8[]))"262 );263 }264265 #[test]266 fn max_size() {267 assert_eq!(<MaxSize>::name(), "!".repeat(SIGNATURE_SIZE_LIMIT));268 }269270 #[test]271 fn shift() {272 assert_eq!(<(u32,)>::name(), "(uint32)");273 }274275 #[test]276 fn over_max_size() {277 let t = trybuild::TestCases::new();278 t.compile_fail("tests/build_failed/custom_signature_over_max_size.rs");279 }280}1//! # A module for custom signature support.2//!3//! ## Overview4//! This module allows you to create arbitrary signatures for types and functions in compile time.5//!6//! ### Type signatures7//! To create the desired type signature, you need to create your own trait with the `SIGNATURE` constant.8//! Then in the implementation, for the required type, use the macro [`make_signature`]9//! #### Example10//! ```11//! use std::str::from_utf8;12//! use evm_coder::{custom_signature::SignatureUnit, make_signature};13//!14//! // Create trait for our signature15//! trait SoliditySignature {16//! const SIGNATURE: SignatureUnit;17//!18//! fn name() -> &'static str {19//! from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")20//! }21//! }22//!23//! // Make signatures for some types24//! impl SoliditySignature for u8 {25//! const SIGNATURE: SignatureUnit = make_signature!(new fixed("uint8"));26//! }27//! impl SoliditySignature for u32 {28//! const SIGNATURE: SignatureUnit = make_signature!(new fixed("uint32"));29//! }30//! impl<T: SoliditySignature> SoliditySignature for Vec<T> {31//! const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));32//! }33//! impl<A: SoliditySignature, B: SoliditySignature> SoliditySignature for (A, B) {34//! const SIGNATURE: SignatureUnit = make_signature!(new fixed("(") nameof(A::SIGNATURE) fixed(",") nameof(B::SIGNATURE) fixed(")"));35//! }36//! impl<A: SoliditySignature> SoliditySignature for (A,) {37//! const SIGNATURE: SignatureUnit = make_signature!(new fixed("(") nameof(A::SIGNATURE) fixed(",") shift_left(1) fixed(")"));38//! }39//!40//! assert_eq!(u8::name(), "uint8");41//! assert_eq!(<Vec<u8>>::name(), "uint8[]");42//! assert_eq!(<(u32, u8)>::name(), "(uint32,uint8)");43//! ```44//!45//! ### Function signatures46//! To create a function signature, the macro [`make_signature`] is also used, which accepts47//! settings for the function format [`SignaturePreferences`] and function parameters [`SignatureUnit`]48//! #### Example49//! ```50//! use core::str::from_utf8;51//! use evm_coder::{custom_signature::SignatureUnit, make_signature};52//! // Trait for our signature53//! trait SoliditySignature {54//! const SIGNATURE: SignatureUnit;55//!56//! fn name() -> &'static str {57//! from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")58//! }59//! }60//!61//! // Make signatures for some types62//! impl SoliditySignature for u8 {63//! const SIGNATURE: SignatureUnit = make_signature!(new fixed("uint8"));64//! }65//! impl<T: SoliditySignature> SoliditySignature for Vec<T> {66//! const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));67//! }68//! ```6970/// The maximum length of the signature.71pub const SIGNATURE_SIZE_LIMIT: usize = 256;7273/// Storage for the signature or its elements.74#[derive(Debug)]75pub struct SignatureUnit {76 /// Signature data.77 pub data: [u8; SIGNATURE_SIZE_LIMIT],78 /// The actual size of the data.79 pub len: usize,80}8182impl SignatureUnit {83 /// Create a signature from `&str'.84 pub const fn new(name: &'static str) -> SignatureUnit {85 let mut signature = [0_u8; SIGNATURE_SIZE_LIMIT];86 let name = name.as_bytes();87 let name_len = name.len();88 let mut dst_offset = 0;89 crate::make_signature!(@copy(name, signature, name_len, dst_offset));90 SignatureUnit {91 data: signature,92 len: name_len,93 }94 }95 /// String conversion96 pub fn as_str(&self) -> Option<&str> {97 core::str::from_utf8(&self.data[0..self.len]).ok()98 }99}100101/// ### Macro to create signatures of types and functions.102///103/// Format for creating a type of signature:104/// ```ignore105/// make_signature!(new fixed("uint8")); // Simple type106/// make_signature!(new fixed("(") nameof(u8) fixed(",") nameof(u8) fixed(")")); // Composite type107/// ```108#[macro_export]109macro_rules! make_signature {110 (new $($tt:tt)*) => {111 ($crate::custom_signature::SignatureUnit {112 data: {113 let mut out = [0u8; $crate::custom_signature::SIGNATURE_SIZE_LIMIT];114 let mut dst_offset = 0;115 $crate::make_signature!(@data(out, dst_offset); $($tt)*);116 out117 },118 len: {0 + $crate::make_signature!(@size; $($tt)*)},119 })120 };121122 (@size;) => {123 0124 };125 (@size; fixed($expr:expr) $($tt:tt)*) => {126 $expr.len() + $crate::make_signature!(@size; $($tt)*)127 };128 (@size; nameof($expr:expr) $($tt:tt)*) => {129 $expr.len + $crate::make_signature!(@size; $($tt)*)130 };131 (@size; numof($expr:expr) $($tt:tt)*) => {132 {133 let mut out = 0;134 let mut v = $expr;135 if v == 0 {136 out = 1;137 } else {138 while v > 0 {139 out += 1;140 v /= 10;141 }142 }143 out144 } + $crate::make_signature!(@size; $($tt)*)145 };146 (@size; shift_left($expr:expr) $($tt:tt)*) => {147 $crate::make_signature!(@size; $($tt)*) - $expr148 };149150 (@data($dst:ident, $dst_offset:ident);) => {};151 (@data($dst:ident, $dst_offset:ident); fixed($expr:expr) $($tt:tt)*) => {152 {153 let data = $expr.as_bytes();154 let data_len = data.len();155 $crate::make_signature!(@copy(data, $dst, data_len, $dst_offset));156 }157 $crate::make_signature!(@data($dst, $dst_offset); $($tt)*)158 };159 (@data($dst:ident, $dst_offset:ident); nameof($expr:expr) $($tt:tt)*) => {160 {161 $crate::make_signature!(@copy(&$expr.data, $dst, $expr.len, $dst_offset));162 }163 $crate::make_signature!(@data($dst, $dst_offset); $($tt)*)164 };165 (@data($dst:ident, $dst_offset:ident); numof($expr:expr) $($tt:tt)*) => {166 {167 let mut v = $expr;168 let mut need_to_swap = 0;169 if v == 0 {170 $dst[$dst_offset] = b'0';171 $dst_offset += 1;172 } else {173 while v > 0 {174 let n = (v % 10) as u8;175 $dst[$dst_offset] = b'0' + n;176 v /= 10;177 need_to_swap += 1;178 $dst_offset += 1;179 }180 }181 let mut i = 0;182 #[allow(clippy::manual_swap)]183 while i < need_to_swap / 2 {184 let a = $dst_offset - i - 1;185 let b = $dst_offset - need_to_swap + i;186 let v = $dst[a];187 $dst[a] = $dst[b];188 $dst[b] = v;189 i += 1;190 }191 }192 $crate::make_signature!(@data($dst, $dst_offset); $($tt)*)193 };194 (@data($dst:ident, $dst_offset:ident); shift_left($expr:expr) $($tt:tt)*) => {195 $dst_offset -= $expr;196 $crate::make_signature!(@data($dst, $dst_offset); $($tt)*)197 };198199 (@copy($src:expr, $dst:expr, $src_len:expr, $dst_offset:ident)) => {200 {201 let mut src_offset = 0;202 let src_len: usize = $src_len;203 while src_offset < src_len {204 $dst[$dst_offset] = $src[src_offset];205 $dst_offset += 1;206 src_offset += 1;207 }208 }209 }210}211212#[cfg(test)]213mod test {214 use core::str::from_utf8;215216 use super::{SIGNATURE_SIZE_LIMIT, SignatureUnit};217218 trait Name {219 const NAME: SignatureUnit;220221 fn name() -> &'static str {222 from_utf8(&Self::NAME.data[..Self::NAME.len]).expect("bad utf-8")223 }224 }225226 impl Name for u8 {227 const NAME: SignatureUnit = make_signature!(new fixed("uint8"));228 }229 impl Name for u32 {230 const NAME: SignatureUnit = make_signature!(new fixed("uint32"));231 }232 impl<T: Name> Name for Vec<T> {233 const NAME: SignatureUnit = make_signature!(new nameof(T::NAME) fixed("[]"));234 }235 impl<A: Name, B: Name> Name for (A, B) {236 const NAME: SignatureUnit =237 make_signature!(new fixed("(") nameof(A::NAME) fixed(",") nameof(B::NAME) fixed(")"));238 }239 impl<A: Name> Name for (A,) {240 const NAME: SignatureUnit =241 make_signature!(new fixed("(") nameof(A::NAME) fixed(",") shift_left(1) fixed(")"));242 }243 impl<A: Name, const SIZE: usize> Name for [A; SIZE] {244 const NAME: SignatureUnit =245 make_signature!(new nameof(A::NAME) fixed("[") numof(SIZE) fixed("]"));246 }247248 struct MaxSize();249 impl Name for MaxSize {250 const NAME: SignatureUnit = SignatureUnit {251 data: [b'!'; SIGNATURE_SIZE_LIMIT],252 len: SIGNATURE_SIZE_LIMIT,253 };254 }255256 #[test]257 fn simple() {258 assert_eq!(u8::name(), "uint8");259 assert_eq!(u32::name(), "uint32");260 }261262 #[test]263 fn vector_of_simple() {264 assert_eq!(<Vec<u8>>::name(), "uint8[]");265 assert_eq!(<Vec<u32>>::name(), "uint32[]");266 }267268 #[test]269 fn vector_of_vector() {270 assert_eq!(<Vec<Vec<u8>>>::name(), "uint8[][]");271 }272273 #[test]274 fn tuple_of_simple() {275 assert_eq!(<(u32, u8)>::name(), "(uint32,uint8)");276 }277278 #[test]279 fn tuple_of_tuple() {280 assert_eq!(281 <((u32, u8), (u8, u32))>::name(),282 "((uint32,uint8),(uint8,uint32))"283 );284 }285286 #[test]287 fn vector_of_tuple() {288 assert_eq!(<Vec<(u32, u8)>>::name(), "(uint32,uint8)[]");289 }290291 #[test]292 fn tuple_of_vector() {293 assert_eq!(<(Vec<u32>, u8)>::name(), "(uint32[],uint8)");294 }295296 #[test]297 fn complex() {298 assert_eq!(299 <(Vec<u32>, (u32, Vec<u8>))>::name(),300 "(uint32[],(uint32,uint8[]))"301 );302 }303304 #[test]305 fn max_size() {306 assert_eq!(<MaxSize>::name(), "!".repeat(SIGNATURE_SIZE_LIMIT));307 }308309 #[test]310 fn shift() {311 assert_eq!(<(u32,)>::name(), "(uint32)");312 }313314 #[test]315 fn num() {316 assert_eq!(<[u8; 0]>::name(), "uint8[0]");317 assert_eq!(<[u8; 1234]>::name(), "uint8[1234]");318 assert_eq!(<[u8; 12345]>::name(), "uint8[12345]");319 }320321 #[test]322 fn over_max_size() {323 let t = trybuild::TestCases::new();324 t.compile_fail("tests/build_failed/custom_signature_over_max_size.rs");325 }326}crates/evm-coder/tests/build_failed/custom_signature_over_max_size.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/build_failed/custom_signature_over_max_size.rs
+++ b/crates/evm-coder/tests/build_failed/custom_signature_over_max_size.rs
@@ -15,7 +15,8 @@
}
impl<T: Name> Name for Vec<T> {
- evm_coder::make_signature!(new nameof(T) fixed("[]"));
+ const SIGNATURE: SignatureUnit =
+ evm_coder::make_signature!(new nameof(T::SIGNATURE) fixed("[]"));
}
struct MaxSize();
crates/evm-coder/tests/build_failed/custom_signature_over_max_size.stderrdiffbeforeafterboth--- a/crates/evm-coder/tests/build_failed/custom_signature_over_max_size.stderr
+++ b/crates/evm-coder/tests/build_failed/custom_signature_over_max_size.stderr
@@ -1,18 +1,28 @@
+warning: unused import: `make_signature`
+ --> tests/build_failed/custom_signature_over_max_size.rs:5:2
+ |
+5 | make_signature,
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unused_imports)]` on by default
+
error: any use of this value will cause an error
- --> tests/build_failed/custom_signature_over_max_size.rs:18:2
+ --> tests/build_failed/custom_signature_over_max_size.rs:19:3
|
-18 | evm_coder::make_signature!(new nameof(T) fixed("[]"));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 256 but the index is 256
+18 | const SIGNATURE: SignatureUnit =
+ | ------------------------------
+19 | evm_coder::make_signature!(new nameof(T::SIGNATURE) fixed("[]"));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 256 but the index is 256
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
- = note: this error originates in the macro `make_signature` which comes from the expansion of the macro `evm_coder::make_signature` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::make_signature` which comes from the expansion of the macro `evm_coder::make_signature` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
- --> tests/build_failed/custom_signature_over_max_size.rs:29:29
+ --> tests/build_failed/custom_signature_over_max_size.rs:30:29
|
-29 | const NAME: SignatureUnit = <Vec<MaxSize>>::SIGNATURE;
+30 | const NAME: SignatureUnit = <Vec<MaxSize>>::SIGNATURE;
| ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
crates/evm-coder/tests/conditional_is.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/conditional_is.rs
+++ b/crates/evm-coder/tests/conditional_is.rs
@@ -1,11 +1,4 @@
use evm_coder::{types::*, solidity_interface, execution::Result};
-use evm_coder::{
- make_signature,
- custom_signature::{
- SIGNATURE_SIZE_LIMIT, SignatureUnit, SignaturePreferences, FunctionSignature,
- },
- types::Signature,
-};
pub struct Contract(bool);
crates/evm-coder/tests/generics.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/generics.rs
+++ b/crates/evm-coder/tests/generics.rs
@@ -16,12 +16,6 @@
use std::marker::PhantomData;
use evm_coder::{execution::Result, generate_stubgen, solidity_interface, types::*};
-use evm_coder::{
- make_signature,
- custom_signature::{
- SIGNATURE_SIZE_LIMIT, SignatureUnit, SignaturePreferences, FunctionSignature,
- },
-};
pub struct Generic<T>(PhantomData<T>);
crates/evm-coder/tests/random.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/random.rs
+++ b/crates/evm-coder/tests/random.rs
@@ -17,13 +17,7 @@
#![allow(dead_code)] // This test only checks that macros is not panicking
use evm_coder::{ToLog, execution::Result, solidity_interface, types::*, solidity, weight};
-use evm_coder::{
- make_signature,
- custom_signature::{
- SIGNATURE_SIZE_LIMIT, SignatureUnit, SignaturePreferences, FunctionSignature,
- },
- types::Signature,
-};
+use evm_coder::{types::Signature};
pub struct Impls;
crates/evm-coder/tests/solidity_generation.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/solidity_generation.rs
+++ b/crates/evm-coder/tests/solidity_generation.rs
@@ -15,13 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use evm_coder::{execution::Result, generate_stubgen, solidity_interface, types::*};
-use evm_coder::{
- make_signature,
- custom_signature::{
- SIGNATURE_SIZE_LIMIT, SignatureUnit, SignaturePreferences, FunctionSignature,
- },
- types::Signature,
-};
+use evm_coder::{types::Signature};
pub struct ERC20;