prover

package
v0.3.33 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProveStatusInit = iota
	ProveStatusInProgress
	ProveStatusSuccess
	ProveStatusFailed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ProveRequest added in v0.3.25

type ProveRequest struct {
	Status         int    `json:"status"`
	SrcChainId     uint64 `json:"src_chain_id"`
	Request        []byte `json:"request"`
	Witness        []byte `json:"witness"`
	Proof          string `json:"proof"`
	AppCircuitInfo []byte `json:"app_circuit_info"`
	Err            string `json:"err"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	app sdk.AppCircuit, config ServiceConfig, srcChainConfigs SourceChainConfigs) (*Service, error)

NewService creates a new prover server instance that automatically manages compilation & setup, and serves as a GRPC server that interoperates with brevis sdk in other languages.

func (*Service) Serve

func (s *Service) Serve(bind string, grpcPort, restPort uint) error

type ServiceConfig

type ServiceConfig struct {
	// ProverId is a unique identifier for this prover, defaults to hostname
	ProverId string `mapstructure:"prover_id" json:"prover_id"`

	// SetupDir saves the circuit compilation outputs (proving key, verifying key,
	// verifying key hash)
	SetupDir string `mapstructure:"setup_dir" json:"setup_dir"`

	// SrsDir saves the SRS files that will be automatically downloaded. These files
	// can be shared across different circuits. So the best practice is to have them
	// in a shared directory for all projects. Default to use the same dir as
	// SetupDir if not specified
	SrsDir string `mapstructure:"srs_dir" json:"srs_dir"`

	// GatewayUrl is the Brevis gateway URL, defaults to appsdkv3.brevis.network:443
	GatewayUrl string `mapstructure:"gateway_url" json:"gateway_url"`

	// DirectLoad indicates whether the setup process will parallel compile ccs and load pk vk, without digest check
	DirectLoad bool `mapstructure:"direct_load" json:"direct_load"`

	// ProofPersistenceType currently supporting "syncmap", "file", "badgerdb" and "s3".
	// Defaults to "syncmap".
	ProofPersistenceType string `mapstructure:"proof_persistence_type" json:"proof_persistence_type"`

	// ProofPersistenceOptions as JSON string. See implementations for details.
	ProofPersistenceOptions string `mapstructure:"proof_persistence_options" json:"proof_persistence_options"`

	// PersistenceType currently supporting "syncmap", "file", "badgerdb" and "s3".
	// Defaults to "file" under {setupDir}/input.
	DataPersistenceType string `mapstructure:"data_persistence_type" json:"data_persistence_type"`

	// DataPersistenceOptions as JSON string. See implementations for details.
	DataPersistenceOptions string `mapstructure:"data_persistence_options" json:"data_persistence_options"`

	// ConcurrentFetchLimit limits the number of concurrent on-chain fetches, defaults to 20
	ConcurrentFetchLimit int `mapstructure:"concurrent_fetch_limit" json:"concurrent_fetch_limit"`

	// ConcurrentProveLimit limits the number of concurrent prove actions, defaults to 1
	ConcurrentProveLimit int `mapstructure:"concurrent_prove_limit" json:"concurrent_prove_limit"`
}

func (ServiceConfig) GetSetupDir

func (c ServiceConfig) GetSetupDir() string

func (ServiceConfig) GetSrsDir

func (c ServiceConfig) GetSrsDir() string

type SourceChainConfig added in v0.3.25

type SourceChainConfig struct {
	// ChainId the chain ID
	ChainId uint64 `mapstructure:"chain_id" json:"chain_id"`
	// RpcUrl will be used to query on-chain data by sending rpc call.
	RpcUrl string `mapstructure:"rpc_url" json:"rpc_url"`
}

type SourceChainConfigs added in v0.3.25

type SourceChainConfigs []*SourceChainConfig

Jump to

Keyboard shortcuts

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