Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Change some calls from `encode_to_vec().len()` to `.length()` when wanting to get the rlp encoded length [#5374](https://github.com/lambdaclass/ethrex/pull/5374)
- Use our keccak implementation for receipts bloom filter calculation [#5454](https://github.com/lambdaclass/ethrex/pull/5454)

### 2025-11-27

- Use unchecked swap for stack [#5439](https://github.com/lambdaclass/ethrex/pull/5439)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entry is misleading, as this no longer uses unchecked swap but a hint for the compiler.


### 2025-11-20

- Improve rlp encoding by avoiding extra loops and remove unneeded array vec, also adding a alloc-less length method the default trait impl [#5350](https://github.com/lambdaclass/ethrex/pull/5350)
Expand Down
7 changes: 6 additions & 1 deletion crates/vm/levm/src/call_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
use bytes::Bytes;
use ethrex_common::{Address, U256};
use ethrex_common::{H256, types::Code};
use std::{collections::HashMap, fmt};
use std::{collections::HashMap, fmt, hint::assert_unchecked};

/// [`u64`]s that make up a [`U256`]
const U64_PER_U256: usize = U256::MAX.0.len();
Expand Down Expand Up @@ -148,6 +148,11 @@ impl Stack {
return Err(ExceptionalHalt::StackUnderflow);
}

#[expect(unsafe_code, reason = "self.offset always < STACK_LIMIT")]
unsafe {
assert_unchecked(self.offset < STACK_LIMIT)
};
Comment on lines +152 to +154
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment explaining that this removes a bound check in the call to swap.


self.values.swap(self.offset, index);
Ok(())
}
Expand Down