Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: parse selector hashes in sol macro #730

Merged
merged 7 commits into from
Sep 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code formatting
  • Loading branch information
cre-mer committed Sep 6, 2024
commit e8cd54b728ccffc3e3066b70e947e041659a34f7
6 changes: 3 additions & 3 deletions crates/sol-macro-expander/src/expand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ impl<'ast> ExpCtxt<'ast> {
}
Item::Error(err) => {
let err_selector = self.selector_hash(&self.error_selector(err));
if err_selector.eq("00000000") || err_selector.eq("ffffffff") {
if err_selector.eq("0x00000000") || err_selector.eq("0xffffffff") {
failed = true;
emit_error!(
err.span(),
"illegal usage of reserved error signature hash `0x{}`",
"illegal usage of reserved error signature hash `{}`",
err_selector
);
}
Expand Down Expand Up @@ -562,7 +562,7 @@ impl<'ast> ExpCtxt<'ast> {
}

fn selector_hash(&self, item: &ExprArray<u8>) -> String {
item.array.iter().fold(String::new(), |mut output, b| {
item.array.iter().fold(String::from("0x"), |mut output, b| {
let _ = write!(output, "{b:02X}");
output
})
Expand Down