Skip to content

Commit

Permalink
fix: convert to u32 in keccak precompile.
Browse files Browse the repository at this point in the history
  • Loading branch information
VanhGer committed Jan 14, 2025
1 parent bb9fb74 commit 88fa634
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/precompiles/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub fn keccak(data: &[u8]) -> [u8; 32] {
// covert to u32 to align the memory
for i in (0..len).step_by(4) {
if i + 4 <= len {
let u32_value = u32::from_be_bytes([data[0], data[1], data[2], data[3]]);
let u32_value = u32::from_be_bytes([data[i], data[i + 1], data[i + 2], data[i + 3]]);
u32_array.push(u32_value);
} else {
let mut padded_chunk = [0u8; 4];
Expand Down

0 comments on commit 88fa634

Please sign in to comment.