Documentation ¶
Index ¶
- Variables
- func WithConfig(cfg Config) newRegistrationOptionFunc
- func WithPowVerifier(verifier PowVerifier) newRegistrationOptionFunc
- func WithPrivateKey(privKey ed25519.PrivateKey) newRegistrationOptionFunc
- type Base64Enc
- type CertifierConfig
- type Config
- type PowParams
- type PowVerifier
- type Registration
- func (r *Registration) CertifierInfo() *CertifierConfig
- func (r *Registration) Close() error
- func (r *Registration) OpenRound() uint
- func (r *Registration) PowParams() PowParams
- func (r *Registration) Proof(ctx context.Context, roundId string) (*proofData, error)
- func (r *Registration) Pubkey() ed25519.PublicKey
- func (r *Registration) Run(ctx context.Context) error
- func (r *Registration) Submit(ctx context.Context, challenge, nodeID []byte, nonce uint64, ...) (epoch uint, roundEnd time.Time, err error)
- type WorkerService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPow = errors.New("invalid proof of work") ErrInvalidPowParams = errors.New("invalid proof of work parameters") )
View Source
var ( ErrInvalidCertificate = errors.New("invalid certificate") ErrTooLateToRegister = errors.New("too late to register for the desired round") )
View Source
var ( ErrMaxMembersReached = errors.New("maximum number of round members reached") ErrChallengeAlreadySubmitted = errors.New("challenge is already submitted") ErrConflictingRegistration = errors.New("conflicting registration") )
View Source
var ErrNotFound = leveldb.ErrNotFound
Functions ¶
func WithConfig ¶
func WithConfig(cfg Config) newRegistrationOptionFunc
func WithPowVerifier ¶
func WithPowVerifier(verifier PowVerifier) newRegistrationOptionFunc
func WithPrivateKey ¶
func WithPrivateKey(privKey ed25519.PrivateKey) newRegistrationOptionFunc
Types ¶
type Base64Enc ¶ added in v0.10.0
type Base64Enc []byte
func (*Base64Enc) UnmarshalFlag ¶ added in v0.10.0
type CertifierConfig ¶ added in v0.10.0
type CertifierConfig struct { URL string `long:"certifier-url" description:"The URL of the certifier service"` PubKey Base64Enc `long:"certifier-pubkey" description:"The public key of the certifier service (base64 encoded)"` }
func (CertifierConfig) MarshalLogObject ¶ added in v0.10.0
func (c CertifierConfig) MarshalLogObject(enc zapcore.ObjectEncoder) error
implement zap.ObjectMarshaler interface.
type Config ¶
type Config struct { // FIXME: remove deprecated PoW PowDifficulty uint `long:"pow-difficulty" description:"(DEPRECATED) PoW difficulty (in the number of leading zero bits)"` MaxRoundMembers int `long:"max-round-members" description:"the maximum number of members in a round"` MaxSubmitBatchSize int `long:"max-submit-batch-size" description:"The maximum number of challenges to submit in a single batch"` SubmitFlushInterval time.Duration `long:"submit-flush-interval" description:"The interval between flushes of the submit queue"` Certifier *CertifierConfig }
func DefaultConfig ¶
func DefaultConfig() Config
type PowParams ¶
type PowParams struct { Challenge []byte // Difficulty is the number of leading zero bits required in the hash Difficulty uint }
func NewPowParams ¶
type PowVerifier ¶
type PowVerifier interface { // Verify the proof of work. // // PoW hash is ripemd256(powChallenge || nodeID || poetChallenge || nonce) Verify(poetChallenge, nodeID []byte, nonce uint64) error Params() PowParams SetParams(params PowParams) }
func NewPowVerifier ¶
func NewPowVerifier(params PowParams) PowVerifier
type Registration ¶
type Registration struct {
// contains filtered or unexported fields
}
Registration orchestrates rounds functionality It is responsible for:
- registering challenges,
- scheduling rounds,
- feeding workers with membership tree roots for proof generation,
- serving proofs.
func New ¶
func New( ctx context.Context, genesis time.Time, dbdir string, workerSvc WorkerService, roundCfg roundConfig, opts ...newRegistrationOptionFunc, ) (*Registration, error)
func (*Registration) CertifierInfo ¶ added in v0.10.0
func (r *Registration) CertifierInfo() *CertifierConfig
func (*Registration) Close ¶
func (r *Registration) Close() error
func (*Registration) OpenRound ¶ added in v0.9.6
func (r *Registration) OpenRound() uint
func (*Registration) PowParams ¶
func (r *Registration) PowParams() PowParams
func (*Registration) Proof ¶
func (r *Registration) Proof(ctx context.Context, roundId string) (*proofData, error)
func (*Registration) Pubkey ¶
func (r *Registration) Pubkey() ed25519.PublicKey
Source Files ¶
Click to show internal directories.
Click to hide internal directories.