-
Notifications
You must be signed in to change notification settings - Fork 28
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
chore(blockifier): share the utility felt_to_u128 to starknet api #2093
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Artifacts upload triggered. View details here |
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 6 files reviewed, all discussions resolved (waiting on @barak-b-starkware, @dorimedini-starkware, and @noaov1)
crates/starknet_api/src/core_test.rs
line 131 at r1 (raw file):
format!("{error}"), "Out of range Felt 340282366920938463463374607431768211456 is too big to convert to \ 'u128'."
Note the format changed slightly.
Code quote:
"Out of range Felt 340282366920938463463374607431768211456 is too big to convert to \
'u128'."
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2093 +/- ##
===========================================
+ Coverage 40.10% 77.29% +37.18%
===========================================
Files 26 378 +352
Lines 1895 40029 +38134
Branches 1895 40029 +38134
===========================================
+ Hits 760 30939 +30179
- Misses 1100 6800 +5700
- Partials 35 2290 +2255 ☔ View full report in Codecov by Sentry. |
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.
Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware, @barak-b-starkware, and @noaov1)
crates/blockifier/src/abi/sierra_types.rs
line 46 at r1 (raw file):
pub fn felt_to_u128(felt: &Felt) -> Result<u128, SierraTypeError> { felt.to_u128().ok_or_else(|| SierraTypeError::ValueTooLargeForType { val: *felt, ty: "u128" }) }
isn't it an issue that the returned error type has changed now in the blockifier crate?
Code quote:
pub fn felt_to_u128(felt: &Felt) -> Result<u128, SierraTypeError> {
felt.to_u128().ok_or_else(|| SierraTypeError::ValueTooLargeForType { val: *felt, ty: "u128" })
}
846a828
to
d0a84e0
Compare
8c66340
to
a2b4052
Compare
a2b4052
to
d8c3ddf
Compare
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware, @barak-b-starkware, and @noaov1)
d8c3ddf
to
5185f70
Compare
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
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: 5 of 7 files reviewed, 1 unresolved discussion (waiting on @barak-b-starkware, @dorimedini-starkware, and @noaov1)
crates/blockifier/src/abi/sierra_types.rs
line 46 at r1 (raw file):
Previously, dorimedini-starkware wrote…
isn't it an issue that the returned error type has changed now in the blockifier crate?
This function is only used in the context of this file.
The error is propagated to the OS, so I am not sure.
In any case - I created another PR under this on: #2095. It tries to be in the path of least resistance, yet it solves some issues I have with other projects I am working on.
crates/blockifier/src/abi/sierra_types.rs
line 68 at r1 (raw file):
Ok(Self { val: felt_to_u128(&felt)? }) } }
These are the two places where felt_to_u128
is used (in a non-test setting).
Code quote:
impl SierraType for SierraU128 {
fn from_memory(vm: &VirtualMachine, ptr: &mut Relocatable) -> SierraTypeResult<Self> {
let felt = vm.get_integer(*ptr)?;
*ptr = (*ptr + 1)?;
Ok(Self { val: felt_to_u128(&felt)? })
}
fn from_storage(
state: &dyn StateReader,
contract_address: &ContractAddress,
key: &StorageKey,
) -> SierraTypeResult<Self> {
let felt = state.get_storage_at(*contract_address, *key)?;
Ok(Self { val: felt_to_u128(&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.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @barak-b-starkware and @noaov1)
crates/blockifier/src/abi/sierra_types.rs
line 68 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
These are the two places where
felt_to_u128
is used (in a non-test setting).
who uses SierraU128...?
0708895
to
f6891af
Compare
5185f70
to
240f686
Compare
Artifacts upload triggered. View details here |
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: complete! all files reviewed, all discussions resolved (waiting on @barak-b-starkware and @noaov1)
crates/blockifier/src/abi/sierra_types.rs
line 68 at r1 (raw file):
Previously, dorimedini-starkware wrote…
who uses SierraU128...?
Only in this file, only for SierraU256
. In turn, SeirraU256
is only used in secp.rs
240f686
to
11a7925
Compare
f6891af
to
f0436f8
Compare
11a7925
to
f28da74
Compare
Benchmark movements: |
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: complete! all files reviewed, all discussions resolved (waiting on @barak-b-starkware and @noaov1)
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
f28da74
to
bdc6877
Compare
Artifacts upload triggered. View details here |
No description provided.