Skip to content

Commit

Permalink
Do range-check for the Keccak output which will be converted for Uint…
Browse files Browse the repository at this point in the history
…256 computation.
  • Loading branch information
silathdiir committed Oct 22, 2024
1 parent 1058717 commit 3548cc5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mp2-common/src/storage_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ impl KeccakStructMPT {

// location = keccak(inputs) + offset
let keccak_base = KeccakCircuit::<{ INPUT_PADDED_LEN }>::hash_to_bytes(b, &inputs);
// Do range-check on the output, since these bytes are converted for Uint256 computation
// (not fed as input to another Keccak directly).
keccak_base.output.assert_bytes(b);
let base = keccak_base.output.arr.pack(b, Endianness::Big);
let base = UInt256Target::new_from_be_target_limbs(&base).unwrap();
let offset = UInt256Target::new_from_target_unsafe(b, offset);
Expand Down

0 comments on commit 3548cc5

Please sign in to comment.