solidity

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithProverTargetSolidityVerifier

func WithProverTargetSolidityVerifier(bid backend.ID) backend.ProverOption

WithProverTargetSolidityVerifier returns a prover option that sets all the necessary prover options which are suitable for verifying the proofs in the Solidity verifier.

For PLONK this is a no-op option as the Solidity verifier is directly compatible with the default prover options. Regardless, it is recommended to use this option for consistency and possible future changes in the Solidity verifier.

For Groth16 this option sets the hash function used for hashing bytes to field to sha3.NewLegacyKeccak256 as the Solidity verifier does not support the standard hash-to-field function. We use legacy Keccak256 in Solidity for the cheapest gas usage.

func WithVerifierTargetSolidityVerifier

func WithVerifierTargetSolidityVerifier(bid backend.ID) backend.VerifierOption

WithVerifierTargetSolidityVerifier returns a verifier option that sets all the necessary verifier options which are suitable for verifying the proofs targeted for the Solidity verifier. See the comments in WithProverTargetSolidityVerifier.

Types

type ExportConfig

type ExportConfig struct {
	PragmaVersion string
	HashToFieldFn hash.Hash
}

ExportConfig is the configuration for the prover with the options applied.

func NewExportConfig

func NewExportConfig(opts ...ExportOption) (ExportConfig, error)

NewExportConfig returns a default ExportConfig with given export options opts applied.

type ExportOption

type ExportOption func(*ExportConfig) error

ExportOption defines option for altering the behavior of the prover in Prove, ReadAndProve and IsSolved methods. See the descriptions of functions returning instances of this type for implemented options.

func WithHashToFieldFunction

func WithHashToFieldFunction(hFunc hash.Hash) ExportOption

WithHashToFieldFunction changes the hash function used for hashing bytes to field. If not set then the default hash function based on RFC 9380 is used. Used mainly for compatibility between different systems and efficient recursion.

func WithPragmaVersion

func WithPragmaVersion(version string) ExportOption

WithPragmaVersion changes the pragma version used in the solidity verifier.

type VerifyingKey

type VerifyingKey interface {
	NbPublicWitness() int
	ExportSolidity(io.Writer, ...ExportOption) error
}

VerifyingKey is the interface for verifying keys in the Solidity backend.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL