Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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 @@ -14,6 +14,11 @@ const solidityTemplate = `
{{- $numWitness := sub $numPublic $numCommitments }}
{{- $PublicAndCommitmentCommitted := .Vk.PublicAndCommitmentCommitted }}
// SPDX-License-Identifier: MIT
{{- if .Cfg.SortedImports }}
{{ range $imp := .Cfg.SortedImports }}
{{ $imp }}
{{- end }}
{{- end }}

pragma solidity {{ .Cfg.PragmaVersion }};

Expand All @@ -23,7 +28,7 @@ pragma solidity {{ .Cfg.PragmaVersion }};
/// (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
19 changes: 18 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