Skip to content
Open
Show file tree
Hide file tree
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
19 changes: 18 additions & 1 deletion backend/groth16/bn254/solidity.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ const solidityTemplate = `
// SPDX-License-Identifier: MIT

pragma solidity {{ .Cfg.PragmaVersion }};
{{- if .Cfg.SortedImports }}
{{ range $imp := .Cfg.SortedImports }}
{{ $imp }}
{{- end }}
{{- end }}

/// @title Groth16 verifier template.
/// @author Remco Bloemen
/// @notice Supports verifying Groth16 proofs. Proofs can be in uncompressed
/// (256 bytes) and compressed (128 bytes) format. A view function is provided
/// to compress proofs.
/// @notice See <https://2π.com/23/bn254-compression> for further explanation.
contract Verifier {
contract Verifier{{ .Cfg.InterfaceDeclaration }} {

/// Some of the provided public input values are larger than the field modulus.
/// @dev Public input elements are not automatically reduced, as this is can be
Expand Down Expand Up @@ -121,6 +126,14 @@ contract Verifier {
uint256 constant PUB_{{sub $i 1}}_Y = {{ (fpstr $ki.Y) }};
{{- end }}
{{- end }}
{{- if .Cfg.Constants }}

{{ .Cfg.Constants }}
{{- end }}
{{- if .Cfg.Constructor }}

{{ .Cfg.Constructor }}
{{- end }}

/// Negation in Fp.
/// @notice Returns a number x such that a + x = 0 in Fp.
Expand Down Expand Up @@ -799,6 +812,10 @@ contract Verifier {
revert ProofInvalid();
}
}
{{- if .Cfg.Functions }}

{{ .Cfg.Functions }}
{{- end }}
}
`

Expand Down
20 changes: 19 additions & 1 deletion backend/plonk/bn254/solidity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading