Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possble fix #14

Open
wants to merge 1 commit into
base: v1.3.3
Choose a base branch
from
Open
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
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
Loading