-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
heap_size type to be consistent with request instruction #33354
Conversation
@@ -171,7 +171,7 @@ impl ComputeBudget { | |||
curve25519_ristretto_multiply_cost: 2_208, | |||
curve25519_ristretto_msm_base_cost: 2303, | |||
curve25519_ristretto_msm_incremental_cost: 788, | |||
heap_size: solana_sdk::entrypoint::HEAP_LENGTH, | |||
heap_size: u32::try_from(solana_sdk::entrypoint::HEAP_LENGTH).unwrap(), |
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.
this unwrap
should be safe since we are converting from a const, otherwise it should panic.
@@ -281,7 +281,7 @@ macro_rules! create_vm { | |||
>::zero_filled(stack_size); | |||
let mut heap = solana_rbpf::aligned_memory::AlignedMemory::< | |||
{ solana_rbpf::ebpf::HOST_ALIGN }, | |||
>::zero_filled(heap_size); | |||
>::zero_filled(usize::try_from(heap_size).unwrap()); |
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.
this unwrap()
may fail IF target is 16-bit and heap_size
is too large for that. In that case, panic is proper imo
let mut stack = AlignedMemory::<{ ebpf::HOST_ALIGN }>::zero_filled(config.stack_size()); | ||
let mut heap = AlignedMemory::<{ ebpf::HOST_ALIGN }>::zero_filled(compute_budget.heap_size); | ||
let mut heap = AlignedMemory::<{ ebpf::HOST_ALIGN }>::zero_filled( | ||
usize::try_from(compute_budget.heap_size).unwrap(), |
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.
same as above
5988c91
to
c35529f
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.
small nit, but think the change overall is good
Codecov Report
@@ Coverage Diff @@
## master #33354 +/- ##
=========================================
- Coverage 81.9% 81.9% -0.1%
=========================================
Files 796 796
Lines 215861 215858 -3
=========================================
- Hits 176938 176927 -11
- Misses 38923 38931 +8 |
36e4eb9
to
85d985d
Compare
Problem
RequestHeapFrame(u32)
requests heap size asu32
,ComputeBudget
stores it asusize
, it alsoas
intou64
in some loader functions.Summary of Changes
ComputeBudget
stores heap_size in same type as instruction defines itas
withtry_from
Fixes #