-
Notifications
You must be signed in to change notification settings - Fork 843
deuduplicated a few functions #992
deuduplicated a few functions #992
Conversation
Hey @rrzhang139 just checking, it this ready for review? Feel free to reach out directly or autoassign by assigning it to privacy-scaling-explorations/zkevm-reviewers |
@aguzmant103 I don't have the ability to assign reviewers, but this seems ready to review! Perhaps @ed255 could review this for me? |
Hi @rrzhang139, I can help review this PR. Can you resolve the conflict meanwhile? |
@ChihChengLiang I resolved this, but I am failing tests when running |
@rrzhang139 What are the failing tests you see in The CI reported some failing Clippy checks. You might need to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! The code is less duplicated and looks nicer now!
We can merge once the CI issues are all fixed.
I added some low-hanging fruit refactor opportunities. They might be out of the scope of this PR so feel free to ignore them.
testool/src/statetest/parse.rs
Outdated
if let Some(hex) = as_str.strip_prefix("0x") { | ||
Ok(Address::from_slice( | ||
&hex::decode(hex).context("parse_address")?, | ||
)) | ||
} else { | ||
Ok(Address::from_slice( | ||
&hex::decode(as_str).context("parse_address")?, | ||
)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I see many functions that use strip_prefix
have duplicated lines. We could deduplicate the expression further. It's fine if we don't do it now.
if let Some(hex) = as_str.strip_prefix("0x") { | |
Ok(Address::from_slice( | |
&hex::decode(hex).context("parse_address")?, | |
)) | |
} else { | |
Ok(Address::from_slice( | |
&hex::decode(as_str).context("parse_address")?, | |
)) | |
} | |
let hex = as_str.strip_prefix("0x").unwrap_or(as_str); | |
Ok(Address::from_slice( | |
&hex::decode(hex).context("parse_address")?, | |
)) |
testool/src/statetest/parse.rs
Outdated
if let Some(hex) = as_str.strip_prefix("0x") { | ||
Ok(Address::from_slice( | ||
&hex::decode(hex).context("parse_address")?, | ||
)) | ||
} else { | ||
Ok(Address::from_slice( | ||
&hex::decode(as_str).context("parse_address")?, | ||
)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I see many functions that use strip_prefix
have duplicated lines. We could deduplicate the expression further. It's fine if we don't do it now.
if let Some(hex) = as_str.strip_prefix("0x") { | |
Ok(Address::from_slice( | |
&hex::decode(hex).context("parse_address")?, | |
)) | |
} else { | |
Ok(Address::from_slice( | |
&hex::decode(as_str).context("parse_address")?, | |
)) | |
} | |
let hex = as_str.strip_prefix("0x").unwrap_or(as_str); | |
Ok(Address::from_slice( | |
&hex::decode(hex).context("parse_address")?, | |
)) |
ae841a0
to
47adadd
Compare
@rrzhang139 one more clippy fix to go. |
…ivacy-scaling-explorations#1007) * Fix to check account empty for existence in `BALANCE` bus-mapping. * Add a test case for empty account.
47adadd
to
5acb742
Compare
Thank you @rrzhang139 for the contribution! |
* fix soundness bug in ecdsa circuit * update parameters * fix: ec_sub_unequal would have panicked for some edge cases (privacy-scaling-explorations#999) * update ecdsa parameters --------- Co-authored-by: Rohit Narurkar <rohit.narurkar@protonmail.com>
parse_calldata and parse_code seem to have a few discrepancies between yaml and json version (e.g yaml does not mention asm as tags)