Skip to content

Conversation

@fedacking
Copy link
Contributor

@fedacking fedacking commented Oct 31, 2025

Motivation

During ARM testing, ethrex would crash on certain ARM CPUs. The backtrace of the program was in the blake2b precompile in crates/common/crypto/blake2f/aarch64.rs. The specific instruction that crashed was the XAR instruction, which the documentation states that "This instruction is implemented only when FEAT_SHA3 is implemented."

Description

  • Added check to BLAKE2_FUNC lazy evaluator to check for the sha3 feature in the user's cpu at runtime.

Notes on testing

On an ARM CPU without the feature sha3 the commit fba993c9b337ab2a89664f0f39260b40e25ac4c8 includes a failing unit test. After 21fb29e439261de5c9f275f54a9de218759daa2f the test should work.

@fedacking fedacking requested a review from a team as a code owner October 31, 2025 18:22
@github-actions github-actions bot added the L1 Ethereum client label Oct 31, 2025
@lferrigno lferrigno changed the title fix(l1): fix illegal instructions in certain ARM processores fix(l1): fix illegal instructions in certain ARM processors Oct 31, 2025
@github-actions
Copy link

Lines of code report

Total lines added: 32
Total lines removed: 0
Total lines changed: 32

Detailed view
+--------------------------------------------+-------+------+
| File                                       | Lines | Diff |
+--------------------------------------------+-------+------+
| ethrex/crates/common/crypto/blake2f/mod.rs | 53    | +32  |
+--------------------------------------------+-------+------+

mod tests {
use super::*;
#[test]
fn test_12r() {
Copy link
Contributor

Choose a reason for hiding this comment

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

12r?

Maybe call it blake2b_smoke.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 163a164

@github-project-automation github-project-automation bot moved this to In Review in ethrex_l1 Oct 31, 2025
@fedacking fedacking enabled auto-merge October 31, 2025 18:55
@fedacking fedacking added this pull request to the merge queue Oct 31, 2025
Merged via the queue into main with commit 1f422e9 Oct 31, 2025
29 checks passed
@fedacking fedacking deleted the aarch64-blake-testing branch October 31, 2025 19:50
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Oct 31, 2025
pablodeymo pushed a commit that referenced this pull request Oct 31, 2025
**Motivation**

During ARM testing, ethrex would crash on certain ARM CPUs. The
backtrace of the program was in the blake2b precompile in
`crates/common/crypto/blake2f/aarch64.rs`. The specific instruction that
crashed was the [XAR
instruction](https://developer.arm.com/documentation/ddi0602/2022-03/SIMD-FP-Instructions/XAR--Exclusive-OR-and-Rotate-),
which the documentation states that "This instruction is implemented
only when FEAT_SHA3 is implemented."

**Description**

- Added check to `BLAKE2_FUNC` lazy evaluator to check for the `sha3`
feature in the user's cpu at runtime.

**Notes on testing**

On an ARM CPU without the feature `sha3` the commit
`fba993c9b337ab2a89664f0f39260b40e25ac4c8` includes a failing unit test.
After `21fb29e439261de5c9f275f54a9de218759daa2f` the test should work.
xqft pushed a commit that referenced this pull request Nov 11, 2025
**Motivation**

During ARM testing, ethrex would crash on certain ARM CPUs. The
backtrace of the program was in the blake2b precompile in
`crates/common/crypto/blake2f/aarch64.rs`. The specific instruction that
crashed was the [XAR
instruction](https://developer.arm.com/documentation/ddi0602/2022-03/SIMD-FP-Instructions/XAR--Exclusive-OR-and-Rotate-),
which the documentation states that "This instruction is implemented
only when FEAT_SHA3 is implemented."

**Description**

- Added check to `BLAKE2_FUNC` lazy evaluator to check for the `sha3`
feature in the user's cpu at runtime.

**Notes on testing**

On an ARM CPU without the feature `sha3` the commit
`fba993c9b337ab2a89664f0f39260b40e25ac4c8` includes a failing unit test.
After `21fb29e439261de5c9f275f54a9de218759daa2f` the test should work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants