Skip to content

Commit

Permalink
Merge pull request #12 from reilabs/wz/keccak256
Browse files Browse the repository at this point in the history
[2/4 EIP 4844 in inserter circuit] prover: use Keccak256 implementation form Gnark
  • Loading branch information
wzmuda authored Jun 20, 2024
2 parents ef17aaa + ba5cc6a commit 9666200
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 476 deletions.
5 changes: 4 additions & 1 deletion prover/deletion_circuit.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ func (circuit *DeletionMbuCircuit) Define(api frontend.API) error {
bits_post := abstractor.Call1(api, ToReducedBigEndian{Variable: circuit.PostRoot, Size: 256})
bits = append(bits, bits_post...)

hash := keccak.NewKeccak256(api, circuit.BatchSize*32+2*256, bits...)
hash, err := keccak.Keccak256(api, bits)
if err != nil {
return err
}
sum := abstractor.Call(api, FromBinaryBigEndian{Variable: hash})

// The same endianness conversion has been performed in the hash generation
Expand Down
5 changes: 4 additions & 1 deletion prover/insertion_circuit.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ func (circuit *InsertionMbuCircuit) Define(api frontend.API) error {
bits = append(bits, bits_id...)
}

hash := keccak.NewKeccak256(api, (circuit.BatchSize+2)*256+32, bits...)
hash, err := keccak.Keccak256(api, bits)
if err != nil {
return err
}
sum := abstractor.Call(api, FromBinaryBigEndian{Variable: hash})

// The same endianness conversion has been performed in the hash generation
Expand Down
48 changes: 0 additions & 48 deletions prover/keccak/constants.go

This file was deleted.

Loading

0 comments on commit 9666200

Please sign in to comment.