Skip to content

Commit

Permalink
Merge pull request ethereum#26 from zama-ai/petar/no-proof-verificati…
Browse files Browse the repository at this point in the history
…on-on-gas-estimate

Skip proof verification on gas estimation
  • Loading branch information
dartdart26 committed Jan 5, 2023
2 parents 95cd793 + 13d6e60 commit 62a411a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -1569,13 +1569,18 @@ func verifyZkProof(input []byte) ([]byte, error) {
return body, nil
}

const ciphertextSize = 7008

func (e *verifyCiphertext) Run(accessibleState PrecompileAccessibleState, caller common.Address, addr common.Address, input []byte, readOnly bool) ([]byte, error) {
var ciphertext []byte
if !tomlConfig.Zk.Verify {
// For testing: If input size <= `CiphertextSize`, treat the whole input as ciphertext.
const CiphertextSize = 65544
ciphertext = input[0:minInt(CiphertextSize, len(input))]
// For testing: If input size <= `ciphertextSize`, treat the whole input as ciphertext.
ciphertext = input[0:minInt(ciphertextSize, len(input))]
} else {
// If we are not committing state, skip verificaton and insert a random ciphertext as a result.
if !accessibleState.Interpreter().evm.Commit {
return importRandomCiphertext(accessibleState, ciphertextSize), nil
}
var err error
ciphertext, err = verifyZkProof(input)
if err != nil {
Expand Down

0 comments on commit 62a411a

Please sign in to comment.