-
Notifications
You must be signed in to change notification settings - Fork 61
blockifier: move logic inside felt_size_count #8692
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
base: avivg/blockifier/move_const_fo_felt_size_count
Are you sure you want to change the base?
blockifier: move logic inside felt_size_count #8692
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f8bd57a
to
fc4aacc
Compare
56419e6
to
592d498
Compare
592d498
to
889cd06
Compare
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.
Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @AvivYossef-starkware and @noaov1)
crates/blockifier/src/execution/execution_utils.rs
line 409 at r1 (raw file):
/// Calculates the total number of u32s required to encode the given number of big and small felts. /// Big felts encode to 8 u32s each, small felts encode to 2 u32s each. fn total_u32s_from_felts(n_big_felts: usize, n_small_felts: usize) -> usize {
Changed the name of the func to this:
Suggestion:
encoded_u32_len
crates/blockifier/src/execution/execution_utils.rs
line 416 at r1 (raw file):
.checked_mul(blake_encoding::N_U32S_SMALL_FELT) .expect("Overflow computing small felts u32s"); big_u32s.checked_add(small_u32s).expect("Overflow computing total u32s")
removed checked_add
safety
Seems redundant when looking at other places in the code in which arithmetics with n_steps
are done (steps > u32 count)
Suggestion:
let big_u32s = n_big_felts
.checked_mul(blake_encoding::N_U32S_BIG_FELT)
.expect("Overflow computing big felts u32s");
let small_u32s = n_small_felts
.checked_mul(blake_encoding::N_U32S_SMALL_FELT)
.expect("Overflow computing small felts u32s");
big_u32s.checked_add(small_u32s).expect("Overflow computing total u32s"
crates/blockifier/src/execution/execution_utils.rs
line 459 at r1 (raw file):
/// Returns the number of BLAKE opcodes needed to hash the given felts. /// Each BLAKE opcode processes 16 u32s (partial messages are padded). fn count_blake_opcode(n_big_felts: usize, n_small_felts: usize) -> usize {
Changed the name of the func to this:
Suggestion:
blake_opcode_count
889cd06
to
a519a77
Compare
86ab5e4
to
9c31a44
Compare
90a20d7
to
7a2291c
Compare
9c31a44
to
7777a53
Compare
7a2291c
to
53418be
Compare
7777a53
to
58de25c
Compare
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.
@AvivYossef-starkware reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @noaov1)
crates/blockifier/src/execution/contract_class.rs
line 89 at r2 (raw file):
/// Returns the total number of `u32` words required to encode all felts /// according to the small/large felt encoding scheme.
Suggestion:
encode_felts_to_u32s func
crates/blockifier/src/execution/contract_class.rs
line 92 at r2 (raw file):
pub(crate) fn encoded_u32_len(&self) -> usize { self.large * Self::U32_WORDS_PER_LARGE_FELT + self.small * Self::U32_WORDS_PER_SMALL_FELT }
plz add test that compare it to the actual encoding
Code quote:
pub(crate) fn encoded_u32_len(&self) -> usize {
self.large * Self::U32_WORDS_PER_LARGE_FELT + self.small * Self::U32_WORDS_PER_SMALL_FELT
}
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.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @avivg-starkware and @noaov1)
crates/blockifier/src/execution/contract_class.rs
line 92 at r2 (raw file):
Previously, AvivYossef-starkware wrote…
plz add test that compare it to the actual encoding
Working on it
crates/blockifier/src/execution/contract_class.rs
line 89 at r2 (raw file):
/// Returns the total number of `u32` words required to encode all felts /// according to the small/large felt encoding scheme.
done
58de25c
to
a81bc8c
Compare
53418be
to
6cbb062
Compare
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.
@AvivYossef-starkware reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @avivg-starkware and @noaov1)
crates/blockifier/src/execution/contract_class.rs
line 89 at r2 (raw file):
Previously, avivg-starkware wrote…
done
where?
a81bc8c
to
b76d138
Compare
6cbb062
to
2547751
Compare
2547751
to
f5713fd
Compare
b76d138
to
bbca19d
Compare
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.
Reviewable status: 1 of 4 files reviewed, 4 unresolved discussions (waiting on @AvivYossef-starkware and @noaov1)
crates/blockifier/src/execution/contract_class.rs
line 89 at r2 (raw file):
Previously, AvivYossef-starkware wrote…
where?
sorry, now
crates/blockifier/src/execution/contract_class.rs
line 92 at r2 (raw file):
Previously, avivg-starkware wrote…
Working on it
added
No description provided.