Skip to content

Commit

Permalink
possble fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mm-zk committed Oct 17, 2023
1 parent 3a21c8d commit afbec9d
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/precompiles/keccak256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,20 @@ struct Keccak256VarCore {
state: Keccak256InnerState,
}

fn transmute_state(reference_state: sha3::Keccak256) -> Keccak256InnerState {
// we use a trick that size of both structures is the same, and even though we do not know a stable field layout,
// we can replicate it
let our_wrapper: CoreWrapper = unsafe { std::mem::transmute(reference_state) };

our_wrapper.core.state
}

pub struct KeccakSelfVerifier {
internal_state: sha3::Keccak256,
internal_state: zk_evm::zk_evm_abstractions::precompiles::keccak256::Keccak256,
buffer: zk_evm::zk_evm_abstractions::precompiles::keccak256::Buffer,
}

impl KeccakSelfVerifier {
pub fn new() -> Self {
Self {
internal_state: sha3::Keccak256::new(),
internal_state: zk_evm::zk_evm_abstractions::precompiles::keccak256::Keccak256::new(),
buffer: zk_evm::zk_evm_abstractions::precompiles::keccak256::Buffer::new(),
}
}
pub fn reset(&mut self) {
self.internal_state = sha3::Keccak256::new();
self.internal_state = zk_evm::zk_evm_abstractions::precompiles::keccak256::Keccak256::new();
self.buffer.reset();
}
pub fn add_to_buffer<E: Engine>(
Expand Down

0 comments on commit afbec9d

Please sign in to comment.