This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 857
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace word::Word with WordLoHi (#1747)
### Description Replacing Word with WordHiLo. ### Issue Link #1736 ### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [x] Refactor ### Contents - Replace word::Word with WordLoHi - Replace word::WordCell with WordLoHiCell ### Rationale - WordLimbs and WordCell is used somewhere so couldn't go with that. - ZWord and CWord could be used, however, I saw that Word is actually an alias for Word2 ([source](https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/7f356548dd6dd614289b9700a40fbc80c4949b47/zkevm-circuits/src/util/word.rs#L203)). Which is an alias of WordLimbs<2>. So Word2 could be better than ZWord or CWord, but I think WordHiLo is even better and makes the code more obvious, since we have hi-lo terminology in many places. ### How Has This Been Tested? Built all packages locally.
- Loading branch information
Showing
109 changed files
with
968 additions
and
935 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
use crate::util::word::Word; | ||
use crate::util::word::WordLoHi; | ||
use bus_mapping::circuit_input_builder::NumberOrHash; | ||
use eth_types::Field; | ||
use halo2_proofs::circuit::Value; | ||
|
||
/// Encode the type `NumberOrHash` into a field element | ||
pub fn number_or_hash_to_word<F: Field>(v: &NumberOrHash) -> Word<Value<F>> { | ||
pub fn number_or_hash_to_word<F: Field>(v: &NumberOrHash) -> WordLoHi<Value<F>> { | ||
match v { | ||
NumberOrHash::Number(n) => Word::from(*n as u64).into_value(), | ||
NumberOrHash::Hash(h) => Word::from(*h).into_value(), | ||
NumberOrHash::Number(n) => WordLoHi::from(*n as u64).into_value(), | ||
NumberOrHash::Hash(h) => WordLoHi::from(*h).into_value(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.