From b82aa5d262fc2fcadce679bae4f99d310e7ad0e9 Mon Sep 17 00:00:00 2001 From: malik Date: Wed, 11 Dec 2024 12:25:40 +0100 Subject: [PATCH] sync --- zink/codegen/Cargo.toml | 3 +++ zink/codegen/src/event.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/zink/codegen/Cargo.toml b/zink/codegen/Cargo.toml index f925f27bb..78ff381e5 100644 --- a/zink/codegen/Cargo.toml +++ b/zink/codegen/Cargo.toml @@ -12,6 +12,9 @@ repository.workspace = true [lib] proc-macro = true +[features] +selector = [] + [dependencies] heck.workspace = true hex.workspace = true diff --git a/zink/codegen/src/event.rs b/zink/codegen/src/event.rs index 6f6d78a30..3a06dcc9f 100644 --- a/zink/codegen/src/event.rs +++ b/zink/codegen/src/event.rs @@ -4,7 +4,7 @@ use syn::{ parse::Parse, parse_quote, spanned::Spanned, Abi, Data, DeriveInput, Error, Fields, LitByteStr, Result, Type, Variant, }; -use zabi::keccak256; + /// Custom error type for better error handling #[derive(Debug)] @@ -313,11 +313,13 @@ fn type_to_string(ty: &Type) -> String { } /// Generate topic hash +#[cfg(feature = "selector")] fn generate_topic_hash(input: &str) -> [u8; 32] { keccak256(input.as_bytes().to_vec().as_slice()) } /// Generate data hash +#[cfg(feature = "selector")] fn generate_data_hash(data: &[Vec]) -> [u8; 32] { let flattened: Vec = data.concat(); keccak256(&flattened.as_slice())