Documentation ¶
Overview ¶
Package activation is responsible for creating activation transactions and running the mining flow, coordinating Post building, sending proofs to PoET and building NIPost structs.
Code generated by MockGen. DO NOT EDIT. Source: ./interface.go
Generated by this command:
mockgen -typed -package=activation -destination=./mocks.go -source=./interface.go
Package activation is a generated GoMock package.
Code generated by MockGen. DO NOT EDIT. Source: ./nipost.go
Generated by this command:
mockgen -typed -package=activation -destination=./nipost_mocks.go -source=./nipost.go PoetProvingServiceClient
Package activation is a generated GoMock package.
Index ¶
- Variables
- func LoadNipostChallenge(dir string) (*types.NIPostChallenge, error)
- func SaveNipostChallenge(dir string, ch *types.NIPostChallenge) error
- func SignAndFinalizeAtx(signer *signing.EdSigner, atx *types.ActivationTx) error
- type AtxReceiver
- type AtxReceiverOnAtxCall
- type Builder
- func (b *Builder) Coinbase() types.Address
- func (b *Builder) GetPositioningAtx() (types.ATXID, error)
- func (b *Builder) PublishActivationTx(ctx context.Context) error
- func (b *Builder) Regossip(ctx context.Context) error
- func (b *Builder) SetCoinbase(rewardAddress types.Address)
- func (b *Builder) SmesherID() types.NodeID
- func (b *Builder) Smeshing() bool
- func (b *Builder) StartSmeshing(coinbase types.Address, opts PostSetupOpts) error
- func (b *Builder) StopSmeshing(deleteFiles bool) error
- func (b *Builder) UpdatePoETServers(ctx context.Context, endpoints []string) error
- type BuilderOption
- type Config
- type ErrAtxNotFound
- type HTTPPoetClient
- func (c *HTTPPoetClient) Address() string
- func (c *HTTPPoetClient) PoetServiceID(ctx context.Context) (types.PoetServiceID, error)
- func (c *HTTPPoetClient) PowParams(ctx context.Context) (*PoetPowParams, error)
- func (c *HTTPPoetClient) Proof(ctx context.Context, roundID string) (*types.PoetProofMessage, []types.Member, error)
- func (c *HTTPPoetClient) Submit(ctx context.Context, deadline time.Time, prefix, challenge []byte, ...) (*types.PoetRound, error)
- type HTTPPoetOpt
- type HTTPPoetTestHarness
- type Handler
- func (h *Handler) ContextuallyValidateAtx(atx *types.VerifiedActivationTx) error
- func (h *Handler) FetchReferences(ctx context.Context, atx *types.ActivationTx) error
- func (h *Handler) GetEpochAtxs(epochID types.EpochID) (ids []types.ATXID, err error)
- func (h *Handler) HandleGossipAtx(ctx context.Context, peer p2p.Peer, msg []byte) error
- func (h *Handler) HandleSyncedAtx(ctx context.Context, expHash types.Hash32, peer p2p.Peer, data []byte) error
- func (h *Handler) ProcessAtx(ctx context.Context, atx *types.VerifiedActivationTx) error
- func (h *Handler) SyntacticallyValidate(ctx context.Context, atx *types.ActivationTx) error
- func (h *Handler) SyntacticallyValidateDeps(ctx context.Context, atx *types.ActivationTx) (*types.VerifiedActivationTx, error)
- type MockAtxReceiver
- type MockAtxReceiverMockRecorder
- type MockPoetProvingServiceClient
- func (m *MockPoetProvingServiceClient) Address() string
- func (m *MockPoetProvingServiceClient) EXPECT() *MockPoetProvingServiceClientMockRecorder
- func (m *MockPoetProvingServiceClient) PoetServiceID(arg0 context.Context) (types.PoetServiceID, error)
- func (m *MockPoetProvingServiceClient) PowParams(ctx context.Context) (*PoetPowParams, error)
- func (m *MockPoetProvingServiceClient) Proof(ctx context.Context, roundID string) (*types.PoetProofMessage, []types.Member, error)
- func (m *MockPoetProvingServiceClient) Submit(ctx context.Context, deadline time.Time, prefix, challenge []byte, ...) (*types.PoetRound, error)
- type MockPoetProvingServiceClientMockRecorder
- func (mr *MockPoetProvingServiceClientMockRecorder) Address() *PoetProvingServiceClientAddressCall
- func (mr *MockPoetProvingServiceClientMockRecorder) PoetServiceID(arg0 any) *PoetProvingServiceClientPoetServiceIDCall
- func (mr *MockPoetProvingServiceClientMockRecorder) PowParams(ctx any) *PoetProvingServiceClientPowParamsCall
- func (mr *MockPoetProvingServiceClientMockRecorder) Proof(ctx, roundID any) *PoetProvingServiceClientProofCall
- func (mr *MockPoetProvingServiceClientMockRecorder) Submit(ctx, deadline, prefix, challenge, signature, nodeID, pow any) *PoetProvingServiceClientSubmitCall
- type MockPostVerifier
- type MockPostVerifierMockRecorder
- type MockSmeshingProvider
- func (m *MockSmeshingProvider) Coinbase() types.Address
- func (m *MockSmeshingProvider) EXPECT() *MockSmeshingProviderMockRecorder
- func (m *MockSmeshingProvider) SetCoinbase(coinbase types.Address)
- func (m *MockSmeshingProvider) SmesherID() types.NodeID
- func (m *MockSmeshingProvider) Smeshing() bool
- func (m *MockSmeshingProvider) StartSmeshing(arg0 types.Address, arg1 PostSetupOpts) error
- func (m *MockSmeshingProvider) StopSmeshing(arg0 bool) error
- func (m *MockSmeshingProvider) UpdatePoETServers(ctx context.Context, endpoints []string) error
- type MockSmeshingProviderMockRecorder
- func (mr *MockSmeshingProviderMockRecorder) Coinbase() *SmeshingProviderCoinbaseCall
- func (mr *MockSmeshingProviderMockRecorder) SetCoinbase(coinbase any) *SmeshingProviderSetCoinbaseCall
- func (mr *MockSmeshingProviderMockRecorder) SmesherID() *SmeshingProviderSmesherIDCall
- func (mr *MockSmeshingProviderMockRecorder) Smeshing() *SmeshingProviderSmeshingCall
- func (mr *MockSmeshingProviderMockRecorder) StartSmeshing(arg0, arg1 any) *SmeshingProviderStartSmeshingCall
- func (mr *MockSmeshingProviderMockRecorder) StopSmeshing(arg0 any) *SmeshingProviderStopSmeshingCall
- func (mr *MockSmeshingProviderMockRecorder) UpdatePoETServers(ctx, endpoints any) *SmeshingProviderUpdatePoETServersCall
- type MockatxProvider
- type MockatxProviderMockRecorder
- type MocklayerClock
- type MocklayerClockMockRecorder
- type MocknipostBuilder
- func (m *MocknipostBuilder) BuildNIPost(ctx context.Context, challenge *types.NIPostChallenge) (*types.NIPost, error)
- func (m *MocknipostBuilder) DataDir() string
- func (m *MocknipostBuilder) EXPECT() *MocknipostBuilderMockRecorder
- func (m *MocknipostBuilder) UpdatePoETProvers(arg0 []PoetProvingServiceClient)
- type MocknipostBuilderMockRecorder
- type MocknipostValidator
- func (m *MocknipostValidator) EXPECT() *MocknipostValidatorMockRecorder
- func (m *MocknipostValidator) InitialNIPostChallenge(challenge *types.NIPostChallenge, atxs atxProvider, goldenATXID types.ATXID) error
- func (m *MocknipostValidator) NIPost(ctx context.Context, nodeId types.NodeID, atxId types.ATXID, ...) (uint64, error)
- func (m *MocknipostValidator) NIPostChallenge(challenge *types.NIPostChallenge, atxs atxProvider, nodeID types.NodeID) error
- func (m *MocknipostValidator) NumUnits(cfg *PostConfig, numUnits uint32) error
- func (m *MocknipostValidator) PositioningAtx(id types.ATXID, atxs atxProvider, goldenATXID types.ATXID, ...) error
- func (m *MocknipostValidator) Post(ctx context.Context, nodeId types.NodeID, atxId types.ATXID, Post *types.Post, ...) error
- func (m *MocknipostValidator) PostMetadata(cfg *PostConfig, metadata *types.PostMetadata) error
- func (m *MocknipostValidator) VRFNonce(nodeId types.NodeID, commitmentAtxId types.ATXID, vrfNonce *types.VRFPostIndex, ...) error
- type MocknipostValidatorMockRecorder
- func (mr *MocknipostValidatorMockRecorder) InitialNIPostChallenge(challenge, atxs, goldenATXID any) *nipostValidatorInitialNIPostChallengeCall
- func (mr *MocknipostValidatorMockRecorder) NIPost(ctx, nodeId, atxId, NIPost, expectedChallenge, numUnits any) *nipostValidatorNIPostCall
- func (mr *MocknipostValidatorMockRecorder) NIPostChallenge(challenge, atxs, nodeID any) *nipostValidatorNIPostChallengeCall
- func (mr *MocknipostValidatorMockRecorder) NumUnits(cfg, numUnits any) *nipostValidatorNumUnitsCall
- func (mr *MocknipostValidatorMockRecorder) PositioningAtx(id, atxs, goldenATXID, pubepoch any) *nipostValidatorPositioningAtxCall
- func (mr *MocknipostValidatorMockRecorder) Post(ctx, nodeId, atxId, Post, PostMetadata, numUnits any) *nipostValidatorPostCall
- func (mr *MocknipostValidatorMockRecorder) PostMetadata(cfg, metadata any) *nipostValidatorPostMetadataCall
- func (mr *MocknipostValidatorMockRecorder) VRFNonce(nodeId, commitmentAtxId, vrfNonce, PostMetadata, numUnits any) *nipostValidatorVRFNonceCall
- type MockpoetDbAPI
- type MockpoetDbAPIMockRecorder
- type MockpostSetupProvider
- func (m *MockpostSetupProvider) Benchmark(p PostSetupProvider) (int, error)
- func (m *MockpostSetupProvider) CommitmentAtx() (types.ATXID, error)
- func (m *MockpostSetupProvider) Config() PostConfig
- func (m *MockpostSetupProvider) EXPECT() *MockpostSetupProviderMockRecorder
- func (m *MockpostSetupProvider) GenerateProof(ctx context.Context, challenge []byte, options ...proving.OptionFunc) (*types.Post, *types.PostMetadata, error)
- func (m *MockpostSetupProvider) LastOpts() *PostSetupOpts
- func (m *MockpostSetupProvider) PrepareInitializer(ctx context.Context, opts PostSetupOpts) error
- func (m *MockpostSetupProvider) Providers() ([]PostSetupProvider, error)
- func (m *MockpostSetupProvider) Reset() error
- func (m *MockpostSetupProvider) StartSession(context context.Context) error
- func (m *MockpostSetupProvider) Status() *PostSetupStatus
- func (m *MockpostSetupProvider) VRFNonce() (*types.VRFPostIndex, error)
- type MockpostSetupProviderMockRecorder
- func (mr *MockpostSetupProviderMockRecorder) Benchmark(p any) *postSetupProviderBenchmarkCall
- func (mr *MockpostSetupProviderMockRecorder) CommitmentAtx() *postSetupProviderCommitmentAtxCall
- func (mr *MockpostSetupProviderMockRecorder) Config() *postSetupProviderConfigCall
- func (mr *MockpostSetupProviderMockRecorder) GenerateProof(ctx, challenge any, options ...any) *postSetupProviderGenerateProofCall
- func (mr *MockpostSetupProviderMockRecorder) LastOpts() *postSetupProviderLastOptsCall
- func (mr *MockpostSetupProviderMockRecorder) PrepareInitializer(ctx, opts any) *postSetupProviderPrepareInitializerCall
- func (mr *MockpostSetupProviderMockRecorder) Providers() *postSetupProviderProvidersCall
- func (mr *MockpostSetupProviderMockRecorder) Reset() *postSetupProviderResetCall
- func (mr *MockpostSetupProviderMockRecorder) StartSession(context any) *postSetupProviderStartSessionCall
- func (mr *MockpostSetupProviderMockRecorder) Status() *postSetupProviderStatusCall
- func (mr *MockpostSetupProviderMockRecorder) VRFNonce() *postSetupProviderVRFNonceCall
- type Mocksyncer
- type MocksyncerMockRecorder
- type NIPostBuilder
- type NIPostBuilderOption
- type OffloadingPostVerifier
- type PoETClientInitializer
- type PoetClientOpts
- type PoetConfig
- type PoetDb
- func (db *PoetDb) GetProof(proofRef types.PoetProofRef) (*types.PoetProof, *types.Hash32, error)
- func (db *PoetDb) GetProofMessage(proofRef types.PoetProofRef) ([]byte, error)
- func (db *PoetDb) GetProofRef(poetID []byte, roundID string) (types.PoetProofRef, error)
- func (db *PoetDb) HasProof(proofRef types.PoetProofRef) bool
- func (db *PoetDb) StoreProof(ctx context.Context, ref types.PoetProofRef, ...) error
- func (db *PoetDb) Validate(root []byte, proof types.PoetProof, poetID []byte, roundID string, ...) error
- func (db *PoetDb) ValidateAndStore(ctx context.Context, proofMessage *types.PoetProofMessage) error
- func (db *PoetDb) ValidateAndStoreMsg(ctx context.Context, expHash types.Hash32, _ p2p.Peer, data []byte) error
- type PoetPoW
- type PoetPowParams
- type PoetProvingServiceClient
- type PoetProvingServiceClientAddressCall
- func (c *PoetProvingServiceClientAddressCall) Do(f func() string) *PoetProvingServiceClientAddressCall
- func (c *PoetProvingServiceClientAddressCall) DoAndReturn(f func() string) *PoetProvingServiceClientAddressCall
- func (c *PoetProvingServiceClientAddressCall) Return(arg0 string) *PoetProvingServiceClientAddressCall
- type PoetProvingServiceClientPoetServiceIDCall
- func (c *PoetProvingServiceClientPoetServiceIDCall) Do(f func(context.Context) (types.PoetServiceID, error)) *PoetProvingServiceClientPoetServiceIDCall
- func (c *PoetProvingServiceClientPoetServiceIDCall) DoAndReturn(f func(context.Context) (types.PoetServiceID, error)) *PoetProvingServiceClientPoetServiceIDCall
- func (c *PoetProvingServiceClientPoetServiceIDCall) Return(arg0 types.PoetServiceID, arg1 error) *PoetProvingServiceClientPoetServiceIDCall
- type PoetProvingServiceClientPowParamsCall
- func (c *PoetProvingServiceClientPowParamsCall) Do(f func(context.Context) (*PoetPowParams, error)) *PoetProvingServiceClientPowParamsCall
- func (c *PoetProvingServiceClientPowParamsCall) DoAndReturn(f func(context.Context) (*PoetPowParams, error)) *PoetProvingServiceClientPowParamsCall
- func (c *PoetProvingServiceClientPowParamsCall) Return(arg0 *PoetPowParams, arg1 error) *PoetProvingServiceClientPowParamsCall
- type PoetProvingServiceClientProofCall
- func (c *PoetProvingServiceClientProofCall) Do(...) *PoetProvingServiceClientProofCall
- func (c *PoetProvingServiceClientProofCall) DoAndReturn(...) *PoetProvingServiceClientProofCall
- func (c *PoetProvingServiceClientProofCall) Return(arg0 *types.PoetProofMessage, arg1 []types.Member, arg2 error) *PoetProvingServiceClientProofCall
- type PoetProvingServiceClientSubmitCall
- func (c *PoetProvingServiceClientSubmitCall) Do(...) *PoetProvingServiceClientSubmitCall
- func (c *PoetProvingServiceClientSubmitCall) DoAndReturn(...) *PoetProvingServiceClientSubmitCall
- func (c *PoetProvingServiceClientSubmitCall) Return(arg0 *types.PoetRound, arg1 error) *PoetProvingServiceClientSubmitCall
- type PoetSvcUnstableError
- type PostConfig
- type PostProofVerifyingOpts
- type PostProviderID
- type PostProvingOpts
- type PostSetupManager
- func (mgr *PostSetupManager) Benchmark(p PostSetupProvider) (int, error)
- func (mgr *PostSetupManager) BestProvider() (*PostSetupProvider, error)
- func (mgr *PostSetupManager) CommitmentAtx() (types.ATXID, error)
- func (mgr *PostSetupManager) Config() PostConfig
- func (mgr *PostSetupManager) GenerateProof(ctx context.Context, challenge []byte, options ...proving.OptionFunc) (*types.Post, *types.PostMetadata, error)
- func (mgr *PostSetupManager) LastOpts() *PostSetupOpts
- func (mgr *PostSetupManager) PrepareInitializer(ctx context.Context, opts PostSetupOpts) error
- func (*PostSetupManager) Providers() ([]PostSetupProvider, error)
- func (mgr *PostSetupManager) Reset() error
- func (mgr *PostSetupManager) StartSession(ctx context.Context) error
- func (mgr *PostSetupManager) Status() *PostSetupStatus
- func (mgr *PostSetupManager) VRFNonce() (*types.VRFPostIndex, error)
- type PostSetupOpts
- type PostSetupProvider
- type PostSetupState
- type PostSetupStatus
- type PostVerifier
- type PostVerifierCloseCall
- type PostVerifierVerifyCall
- type PowDifficulty
- type SmeshingProvider
- type SmeshingProviderCoinbaseCall
- type SmeshingProviderSetCoinbaseCall
- type SmeshingProviderSmesherIDCall
- type SmeshingProviderSmeshingCall
- type SmeshingProviderStartSmeshingCall
- func (c *SmeshingProviderStartSmeshingCall) Do(f func(types.Address, PostSetupOpts) error) *SmeshingProviderStartSmeshingCall
- func (c *SmeshingProviderStartSmeshingCall) DoAndReturn(f func(types.Address, PostSetupOpts) error) *SmeshingProviderStartSmeshingCall
- func (c *SmeshingProviderStartSmeshingCall) Return(arg0 error) *SmeshingProviderStartSmeshingCall
- type SmeshingProviderStopSmeshingCall
- func (c *SmeshingProviderStopSmeshingCall) Do(f func(bool) error) *SmeshingProviderStopSmeshingCall
- func (c *SmeshingProviderStopSmeshingCall) DoAndReturn(f func(bool) error) *SmeshingProviderStopSmeshingCall
- func (c *SmeshingProviderStopSmeshingCall) Return(arg0 error) *SmeshingProviderStopSmeshingCall
- type SmeshingProviderUpdatePoETServersCall
- func (c *SmeshingProviderUpdatePoETServersCall) Do(f func(context.Context, []string) error) *SmeshingProviderUpdatePoETServersCall
- func (c *SmeshingProviderUpdatePoETServersCall) DoAndReturn(f func(context.Context, []string) error) *SmeshingProviderUpdatePoETServersCall
- func (c *SmeshingProviderUpdatePoETServersCall) Return(arg0 error) *SmeshingProviderUpdatePoETServersCall
- type Validator
- func (v *Validator) InitialNIPostChallenge(challenge *types.NIPostChallenge, atxs atxProvider, goldenATXID types.ATXID) error
- func (v *Validator) NIPost(ctx context.Context, nodeId types.NodeID, commitmentAtxId types.ATXID, ...) (uint64, error)
- func (*Validator) NIPostChallenge(challenge *types.NIPostChallenge, atxs atxProvider, nodeID types.NodeID) error
- func (*Validator) NumUnits(cfg *PostConfig, numUnits uint32) error
- func (v *Validator) PositioningAtx(id types.ATXID, atxs atxProvider, goldenATXID types.ATXID, ...) error
- func (v *Validator) Post(ctx context.Context, nodeId types.NodeID, commitmentAtxId types.ATXID, ...) error
- func (*Validator) PostMetadata(cfg *PostConfig, metadata *types.PostMetadata) error
- func (v *Validator) VRFNonce(nodeId types.NodeID, commitmentAtxId types.ATXID, vrfNonce *types.VRFPostIndex, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrATXChallengeExpired is returned when atx missed its publication window and needs to be regenerated. ErrATXChallengeExpired = errors.New("builder: atx expired") // ErrPoetServiceUnstable is returned when poet quality of service is low. ErrPoetServiceUnstable = &PoetSvcUnstableError{} // ErrPoetProofNotReceived is returned when no poet proof was received. ErrPoetProofNotReceived = errors.New("builder: didn't receive any poet proof") )
var ( ErrNotFound = errors.New("not found") ErrInvalidRequest = errors.New("invalid request") )
var ErrObjectExists = sql.ErrObjectExists
Functions ¶
func LoadNipostChallenge ¶ added in v1.0.0
func LoadNipostChallenge(dir string) (*types.NIPostChallenge, error)
func SaveNipostChallenge ¶ added in v1.0.0
func SaveNipostChallenge(dir string, ch *types.NIPostChallenge) error
func SignAndFinalizeAtx ¶ added in v1.0.0
func SignAndFinalizeAtx(signer *signing.EdSigner, atx *types.ActivationTx) error
SignAndFinalizeAtx signs the atx with specified signer and calculates the ID of the ATX.
Types ¶
type AtxReceiver ¶ added in v1.0.0
type AtxReceiver interface {
OnAtx(*types.ActivationTxHeader)
}
type AtxReceiverOnAtxCall ¶ added in v1.1.5
AtxReceiverOnAtxCall wrap *gomock.Call
func (*AtxReceiverOnAtxCall) Do ¶ added in v1.1.5
func (c *AtxReceiverOnAtxCall) Do(f func(*types.ActivationTxHeader)) *AtxReceiverOnAtxCall
Do rewrite *gomock.Call.Do
func (*AtxReceiverOnAtxCall) DoAndReturn ¶ added in v1.1.5
func (c *AtxReceiverOnAtxCall) DoAndReturn(f func(*types.ActivationTxHeader)) *AtxReceiverOnAtxCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*AtxReceiverOnAtxCall) Return ¶ added in v1.1.5
func (c *AtxReceiverOnAtxCall) Return() *AtxReceiverOnAtxCall
Return rewrite *gomock.Call.Return
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder struct is the struct that orchestrates the creation of activation transactions it is responsible for initializing post, receiving poet proof and orchestrating nipst. after which it will calculate total weight and providing relevant view as proof.
func NewBuilder ¶
func NewBuilder( conf Config, nodeID types.NodeID, signer *signing.EdSigner, cdb *datastore.CachedDB, publisher pubsub.Publisher, nipostBuilder nipostBuilder, postSetupProvider postSetupProvider, layerClock layerClock, syncer syncer, log log.Log, opts ...BuilderOption, ) *Builder
NewBuilder returns an atx builder that will start a routine that will attempt to create an atx upon each new layer.
func (*Builder) GetPositioningAtx ¶
GetPositioningAtx returns atx id with the highest tick height.
func (*Builder) PublishActivationTx ¶
PublishActivationTx attempts to publish an atx, it returns an error if an atx cannot be created.
func (*Builder) SetCoinbase ¶ added in v1.0.0
SetCoinbase sets the address rewardAddress to be the coinbase account written into the activation transaction the rewards for blocks made by this miner will go to this address.
func (*Builder) SmesherID ¶ added in v1.0.0
SmesherID returns the ID of the smesher that created this activation.
func (*Builder) StartSmeshing ¶ added in v1.0.0
func (b *Builder) StartSmeshing(coinbase types.Address, opts PostSetupOpts) error
StartSmeshing is the main entry point of the atx builder. It runs the main loop of the builder in a new go-routine and shouldn't be called more than once without calling StopSmeshing in between. If the post data is incomplete or missing, data creation session will be preceded. Changing of the post options (e.g., number of labels), after initial setup, is supported. If data creation fails for any reason then the go-routine will panic.
func (*Builder) StopSmeshing ¶ added in v1.0.0
StopSmeshing stops the atx builder. It doesn't wait for the smeshing to stop.
type BuilderOption ¶ added in v1.0.0
type BuilderOption func(*Builder)
BuilderOption ...
func WithContext ¶ added in v1.0.0
func WithContext(ctx context.Context) BuilderOption
WithContext modifies parent context for background job.
func WithPoETClientInitializer ¶ added in v1.0.0
func WithPoETClientInitializer(initializer PoETClientInitializer) BuilderOption
WithPoETClientInitializer modifies initialization logic for PoET client. Used during client update.
func WithPoetConfig ¶ added in v1.0.0
func WithPoetConfig(c PoetConfig) BuilderOption
WithPoetConfig sets the poet config.
func WithPoetRetryInterval ¶ added in v1.0.0
func WithPoetRetryInterval(interval time.Duration) BuilderOption
WithPoetRetryInterval modifies time that builder will have to wait before retrying ATX build process if it failed due to issues with PoET server.
func WithValidator ¶ added in v1.0.3
func WithValidator(v nipostValidator) BuilderOption
type Config ¶ added in v0.1.28
type Config struct { CoinbaseAccount types.Address GoldenATXID types.ATXID LayersPerEpoch uint32 RegossipInterval time.Duration }
Config defines configuration for Builder.
type ErrAtxNotFound ¶
func (*ErrAtxNotFound) Error ¶ added in v1.0.0
func (e *ErrAtxNotFound) Error() string
func (*ErrAtxNotFound) Is ¶ added in v1.0.0
func (e *ErrAtxNotFound) Is(target error) bool
func (*ErrAtxNotFound) Unwrap ¶ added in v1.0.0
func (e *ErrAtxNotFound) Unwrap() error
type HTTPPoetClient ¶
type HTTPPoetClient struct {
// contains filtered or unexported fields
}
HTTPPoetClient implements PoetProvingServiceClient interface.
func NewHTTPPoetClient ¶
func NewHTTPPoetClient(baseUrl string, cfg PoetConfig, opts ...PoetClientOpts) (*HTTPPoetClient, error)
NewHTTPPoetClient returns new instance of HTTPPoetClient connecting to the specified url.
func (*HTTPPoetClient) Address ¶ added in v1.0.8
func (c *HTTPPoetClient) Address() string
func (*HTTPPoetClient) PoetServiceID ¶ added in v0.1.11
func (c *HTTPPoetClient) PoetServiceID(ctx context.Context) (types.PoetServiceID, error)
PoetServiceID returns the public key of the PoET proving service.
func (*HTTPPoetClient) PowParams ¶ added in v1.0.0
func (c *HTTPPoetClient) PowParams(ctx context.Context) (*PoetPowParams, error)
type HTTPPoetOpt ¶ added in v1.0.0
func WithCycleGap ¶ added in v1.0.0
func WithCycleGap(gap time.Duration) HTTPPoetOpt
func WithEpochDuration ¶ added in v1.0.0
func WithEpochDuration(epoch time.Duration) HTTPPoetOpt
func WithGenesis ¶ added in v1.0.0
func WithGenesis(genesis time.Time) HTTPPoetOpt
func WithPhaseShift ¶ added in v1.0.0
func WithPhaseShift(phase time.Duration) HTTPPoetOpt
type HTTPPoetTestHarness ¶ added in v1.0.0
HTTPPoetTestHarness utilizes a local self-contained poet server instance targeted by an HTTP client. It is intended to be used in tests only.
func NewHTTPPoetTestHarness ¶ added in v1.0.0
func NewHTTPPoetTestHarness(ctx context.Context, poetdir string, opts ...HTTPPoetOpt) (*HTTPPoetTestHarness, error)
NewHTTPPoetTestHarness returns a new instance of HTTPPoetHarness.
func (*HTTPPoetTestHarness) RestURL ¶ added in v1.1.5
func (h *HTTPPoetTestHarness) RestURL() *url.URL
type Handler ¶ added in v1.0.0
type Handler struct {
// contains filtered or unexported fields
}
Handler processes the atxs received from all nodes and their validity status.
func NewHandler ¶ added in v1.0.0
func NewHandler( local p2p.Peer, cdb *datastore.CachedDB, edVerifier *signing.EdVerifier, c layerClock, pub pubsub.Publisher, fetcher system.Fetcher, tickSize uint64, goldenATXID types.ATXID, nipostValidator nipostValidator, beacon AtxReceiver, tortoise system.Tortoise, log log.Log, poetCfg PoetConfig, ) *Handler
NewHandler returns a data handler for ATX.
func (*Handler) ContextuallyValidateAtx ¶ added in v1.0.0
func (h *Handler) ContextuallyValidateAtx(atx *types.VerifiedActivationTx) error
ContextuallyValidateAtx ensures that the previous ATX referenced is the last known ATX for the referenced miner ID. If a previous ATX is not referenced, it validates that indeed there's no previous known ATX for that miner ID.
func (*Handler) FetchReferences ¶ added in v1.1.5
FetchReferences fetches referenced ATXs from peers if they are not found in db.
func (*Handler) GetEpochAtxs ¶ added in v1.0.0
GetEpochAtxs returns all valid ATXs received in the epoch epochID.
func (*Handler) HandleGossipAtx ¶ added in v1.0.0
HandleGossipAtx handles the atx gossip data channel.
func (*Handler) HandleSyncedAtx ¶ added in v1.1.0
func (h *Handler) HandleSyncedAtx(ctx context.Context, expHash types.Hash32, peer p2p.Peer, data []byte) error
HandleSyncedAtx handles atxs received by sync.
func (*Handler) ProcessAtx ¶ added in v1.0.0
ProcessAtx validates the active set size declared in the atx, and contextually validates the atx according to atx validation rules it then stores the atx with flag set to validity of the atx.
ATXs received as input must be already syntactically valid. Only contextual validation is performed.
func (*Handler) SyntacticallyValidate ¶ added in v1.1.5
func (*Handler) SyntacticallyValidateDeps ¶ added in v1.1.5
func (h *Handler) SyntacticallyValidateDeps(ctx context.Context, atx *types.ActivationTx) (*types.VerifiedActivationTx, error)
type MockAtxReceiver ¶ added in v1.0.0
type MockAtxReceiver struct {
// contains filtered or unexported fields
}
MockAtxReceiver is a mock of AtxReceiver interface.
func NewMockAtxReceiver ¶ added in v1.0.0
func NewMockAtxReceiver(ctrl *gomock.Controller) *MockAtxReceiver
NewMockAtxReceiver creates a new mock instance.
func (*MockAtxReceiver) EXPECT ¶ added in v1.0.0
func (m *MockAtxReceiver) EXPECT() *MockAtxReceiverMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockAtxReceiver) OnAtx ¶ added in v1.0.0
func (m *MockAtxReceiver) OnAtx(arg0 *types.ActivationTxHeader)
OnAtx mocks base method.
type MockAtxReceiverMockRecorder ¶ added in v1.0.0
type MockAtxReceiverMockRecorder struct {
// contains filtered or unexported fields
}
MockAtxReceiverMockRecorder is the mock recorder for MockAtxReceiver.
func (*MockAtxReceiverMockRecorder) OnAtx ¶ added in v1.0.0
func (mr *MockAtxReceiverMockRecorder) OnAtx(arg0 any) *AtxReceiverOnAtxCall
OnAtx indicates an expected call of OnAtx.
type MockPoetProvingServiceClient ¶ added in v1.0.0
type MockPoetProvingServiceClient struct {
// contains filtered or unexported fields
}
MockPoetProvingServiceClient is a mock of PoetProvingServiceClient interface.
func NewMockPoetProvingServiceClient ¶ added in v1.0.0
func NewMockPoetProvingServiceClient(ctrl *gomock.Controller) *MockPoetProvingServiceClient
NewMockPoetProvingServiceClient creates a new mock instance.
func (*MockPoetProvingServiceClient) Address ¶ added in v1.0.8
func (m *MockPoetProvingServiceClient) Address() string
Address mocks base method.
func (*MockPoetProvingServiceClient) EXPECT ¶ added in v1.0.0
func (m *MockPoetProvingServiceClient) EXPECT() *MockPoetProvingServiceClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPoetProvingServiceClient) PoetServiceID ¶ added in v1.0.0
func (m *MockPoetProvingServiceClient) PoetServiceID(arg0 context.Context) (types.PoetServiceID, error)
PoetServiceID mocks base method.
func (*MockPoetProvingServiceClient) PowParams ¶ added in v1.0.0
func (m *MockPoetProvingServiceClient) PowParams(ctx context.Context) (*PoetPowParams, error)
PowParams mocks base method.
type MockPoetProvingServiceClientMockRecorder ¶ added in v1.0.0
type MockPoetProvingServiceClientMockRecorder struct {
// contains filtered or unexported fields
}
MockPoetProvingServiceClientMockRecorder is the mock recorder for MockPoetProvingServiceClient.
func (*MockPoetProvingServiceClientMockRecorder) Address ¶ added in v1.0.8
func (mr *MockPoetProvingServiceClientMockRecorder) Address() *PoetProvingServiceClientAddressCall
Address indicates an expected call of Address.
func (*MockPoetProvingServiceClientMockRecorder) PoetServiceID ¶ added in v1.0.0
func (mr *MockPoetProvingServiceClientMockRecorder) PoetServiceID(arg0 any) *PoetProvingServiceClientPoetServiceIDCall
PoetServiceID indicates an expected call of PoetServiceID.
func (*MockPoetProvingServiceClientMockRecorder) PowParams ¶ added in v1.0.0
func (mr *MockPoetProvingServiceClientMockRecorder) PowParams(ctx any) *PoetProvingServiceClientPowParamsCall
PowParams indicates an expected call of PowParams.
func (*MockPoetProvingServiceClientMockRecorder) Proof ¶ added in v1.0.0
func (mr *MockPoetProvingServiceClientMockRecorder) Proof(ctx, roundID any) *PoetProvingServiceClientProofCall
Proof indicates an expected call of Proof.
func (*MockPoetProvingServiceClientMockRecorder) Submit ¶ added in v1.0.0
func (mr *MockPoetProvingServiceClientMockRecorder) Submit(ctx, deadline, prefix, challenge, signature, nodeID, pow any) *PoetProvingServiceClientSubmitCall
Submit indicates an expected call of Submit.
type MockPostVerifier ¶ added in v1.0.0
type MockPostVerifier struct {
// contains filtered or unexported fields
}
MockPostVerifier is a mock of PostVerifier interface.
func NewMockPostVerifier ¶ added in v1.0.0
func NewMockPostVerifier(ctrl *gomock.Controller) *MockPostVerifier
NewMockPostVerifier creates a new mock instance.
func (*MockPostVerifier) Close ¶ added in v1.0.0
func (m *MockPostVerifier) Close() error
Close mocks base method.
func (*MockPostVerifier) EXPECT ¶ added in v1.0.0
func (m *MockPostVerifier) EXPECT() *MockPostVerifierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPostVerifier) Verify ¶ added in v1.0.0
func (m_2 *MockPostVerifier) Verify(ctx context.Context, p *shared.Proof, m *shared.ProofMetadata, opts ...verifying.OptionFunc) error
Verify mocks base method.
type MockPostVerifierMockRecorder ¶ added in v1.0.0
type MockPostVerifierMockRecorder struct {
// contains filtered or unexported fields
}
MockPostVerifierMockRecorder is the mock recorder for MockPostVerifier.
func (*MockPostVerifierMockRecorder) Close ¶ added in v1.0.0
func (mr *MockPostVerifierMockRecorder) Close() *PostVerifierCloseCall
Close indicates an expected call of Close.
func (*MockPostVerifierMockRecorder) Verify ¶ added in v1.0.0
func (mr *MockPostVerifierMockRecorder) Verify(ctx, p, m any, opts ...any) *PostVerifierVerifyCall
Verify indicates an expected call of Verify.
type MockSmeshingProvider ¶ added in v1.0.0
type MockSmeshingProvider struct {
// contains filtered or unexported fields
}
MockSmeshingProvider is a mock of SmeshingProvider interface.
func NewMockSmeshingProvider ¶ added in v1.0.0
func NewMockSmeshingProvider(ctrl *gomock.Controller) *MockSmeshingProvider
NewMockSmeshingProvider creates a new mock instance.
func (*MockSmeshingProvider) Coinbase ¶ added in v1.0.0
func (m *MockSmeshingProvider) Coinbase() types.Address
Coinbase mocks base method.
func (*MockSmeshingProvider) EXPECT ¶ added in v1.0.0
func (m *MockSmeshingProvider) EXPECT() *MockSmeshingProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSmeshingProvider) SetCoinbase ¶ added in v1.0.0
func (m *MockSmeshingProvider) SetCoinbase(coinbase types.Address)
SetCoinbase mocks base method.
func (*MockSmeshingProvider) SmesherID ¶ added in v1.0.0
func (m *MockSmeshingProvider) SmesherID() types.NodeID
SmesherID mocks base method.
func (*MockSmeshingProvider) Smeshing ¶ added in v1.0.0
func (m *MockSmeshingProvider) Smeshing() bool
Smeshing mocks base method.
func (*MockSmeshingProvider) StartSmeshing ¶ added in v1.0.0
func (m *MockSmeshingProvider) StartSmeshing(arg0 types.Address, arg1 PostSetupOpts) error
StartSmeshing mocks base method.
func (*MockSmeshingProvider) StopSmeshing ¶ added in v1.0.0
func (m *MockSmeshingProvider) StopSmeshing(arg0 bool) error
StopSmeshing mocks base method.
func (*MockSmeshingProvider) UpdatePoETServers ¶ added in v1.0.0
func (m *MockSmeshingProvider) UpdatePoETServers(ctx context.Context, endpoints []string) error
UpdatePoETServers mocks base method.
type MockSmeshingProviderMockRecorder ¶ added in v1.0.0
type MockSmeshingProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockSmeshingProviderMockRecorder is the mock recorder for MockSmeshingProvider.
func (*MockSmeshingProviderMockRecorder) Coinbase ¶ added in v1.0.0
func (mr *MockSmeshingProviderMockRecorder) Coinbase() *SmeshingProviderCoinbaseCall
Coinbase indicates an expected call of Coinbase.
func (*MockSmeshingProviderMockRecorder) SetCoinbase ¶ added in v1.0.0
func (mr *MockSmeshingProviderMockRecorder) SetCoinbase(coinbase any) *SmeshingProviderSetCoinbaseCall
SetCoinbase indicates an expected call of SetCoinbase.
func (*MockSmeshingProviderMockRecorder) SmesherID ¶ added in v1.0.0
func (mr *MockSmeshingProviderMockRecorder) SmesherID() *SmeshingProviderSmesherIDCall
SmesherID indicates an expected call of SmesherID.
func (*MockSmeshingProviderMockRecorder) Smeshing ¶ added in v1.0.0
func (mr *MockSmeshingProviderMockRecorder) Smeshing() *SmeshingProviderSmeshingCall
Smeshing indicates an expected call of Smeshing.
func (*MockSmeshingProviderMockRecorder) StartSmeshing ¶ added in v1.0.0
func (mr *MockSmeshingProviderMockRecorder) StartSmeshing(arg0, arg1 any) *SmeshingProviderStartSmeshingCall
StartSmeshing indicates an expected call of StartSmeshing.
func (*MockSmeshingProviderMockRecorder) StopSmeshing ¶ added in v1.0.0
func (mr *MockSmeshingProviderMockRecorder) StopSmeshing(arg0 any) *SmeshingProviderStopSmeshingCall
StopSmeshing indicates an expected call of StopSmeshing.
func (*MockSmeshingProviderMockRecorder) UpdatePoETServers ¶ added in v1.0.0
func (mr *MockSmeshingProviderMockRecorder) UpdatePoETServers(ctx, endpoints any) *SmeshingProviderUpdatePoETServersCall
UpdatePoETServers indicates an expected call of UpdatePoETServers.
type MockatxProvider ¶ added in v1.0.0
type MockatxProvider struct {
// contains filtered or unexported fields
}
MockatxProvider is a mock of atxProvider interface.
func NewMockatxProvider ¶ added in v1.0.0
func NewMockatxProvider(ctrl *gomock.Controller) *MockatxProvider
NewMockatxProvider creates a new mock instance.
func (*MockatxProvider) EXPECT ¶ added in v1.0.0
func (m *MockatxProvider) EXPECT() *MockatxProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockatxProvider) GetAtxHeader ¶ added in v1.0.0
func (m *MockatxProvider) GetAtxHeader(id types.ATXID) (*types.ActivationTxHeader, error)
GetAtxHeader mocks base method.
type MockatxProviderMockRecorder ¶ added in v1.0.0
type MockatxProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockatxProviderMockRecorder is the mock recorder for MockatxProvider.
func (*MockatxProviderMockRecorder) GetAtxHeader ¶ added in v1.0.0
func (mr *MockatxProviderMockRecorder) GetAtxHeader(id any) *atxProviderGetAtxHeaderCall
GetAtxHeader indicates an expected call of GetAtxHeader.
type MocklayerClock ¶ added in v1.0.0
type MocklayerClock struct {
// contains filtered or unexported fields
}
MocklayerClock is a mock of layerClock interface.
func NewMocklayerClock ¶ added in v1.0.0
func NewMocklayerClock(ctrl *gomock.Controller) *MocklayerClock
NewMocklayerClock creates a new mock instance.
func (*MocklayerClock) AwaitLayer ¶ added in v1.0.0
func (m *MocklayerClock) AwaitLayer(layerID types.LayerID) <-chan struct{}
AwaitLayer mocks base method.
func (*MocklayerClock) CurrentLayer ¶ added in v1.0.0
func (m *MocklayerClock) CurrentLayer() types.LayerID
CurrentLayer mocks base method.
func (*MocklayerClock) EXPECT ¶ added in v1.0.0
func (m *MocklayerClock) EXPECT() *MocklayerClockMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MocklayerClock) LayerToTime ¶ added in v1.0.0
func (m *MocklayerClock) LayerToTime(arg0 types.LayerID) time.Time
LayerToTime mocks base method.
type MocklayerClockMockRecorder ¶ added in v1.0.0
type MocklayerClockMockRecorder struct {
// contains filtered or unexported fields
}
MocklayerClockMockRecorder is the mock recorder for MocklayerClock.
func (*MocklayerClockMockRecorder) AwaitLayer ¶ added in v1.0.0
func (mr *MocklayerClockMockRecorder) AwaitLayer(layerID any) *layerClockAwaitLayerCall
AwaitLayer indicates an expected call of AwaitLayer.
func (*MocklayerClockMockRecorder) CurrentLayer ¶ added in v1.0.0
func (mr *MocklayerClockMockRecorder) CurrentLayer() *layerClockCurrentLayerCall
CurrentLayer indicates an expected call of CurrentLayer.
func (*MocklayerClockMockRecorder) LayerToTime ¶ added in v1.0.0
func (mr *MocklayerClockMockRecorder) LayerToTime(arg0 any) *layerClockLayerToTimeCall
LayerToTime indicates an expected call of LayerToTime.
type MocknipostBuilder ¶ added in v1.0.0
type MocknipostBuilder struct {
// contains filtered or unexported fields
}
MocknipostBuilder is a mock of nipostBuilder interface.
func NewMocknipostBuilder ¶ added in v1.0.0
func NewMocknipostBuilder(ctrl *gomock.Controller) *MocknipostBuilder
NewMocknipostBuilder creates a new mock instance.
func (*MocknipostBuilder) BuildNIPost ¶ added in v1.0.0
func (m *MocknipostBuilder) BuildNIPost(ctx context.Context, challenge *types.NIPostChallenge) (*types.NIPost, error)
BuildNIPost mocks base method.
func (*MocknipostBuilder) DataDir ¶ added in v1.0.0
func (m *MocknipostBuilder) DataDir() string
DataDir mocks base method.
func (*MocknipostBuilder) EXPECT ¶ added in v1.0.0
func (m *MocknipostBuilder) EXPECT() *MocknipostBuilderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MocknipostBuilder) UpdatePoETProvers ¶ added in v1.0.0
func (m *MocknipostBuilder) UpdatePoETProvers(arg0 []PoetProvingServiceClient)
UpdatePoETProvers mocks base method.
type MocknipostBuilderMockRecorder ¶ added in v1.0.0
type MocknipostBuilderMockRecorder struct {
// contains filtered or unexported fields
}
MocknipostBuilderMockRecorder is the mock recorder for MocknipostBuilder.
func (*MocknipostBuilderMockRecorder) BuildNIPost ¶ added in v1.0.0
func (mr *MocknipostBuilderMockRecorder) BuildNIPost(ctx, challenge any) *nipostBuilderBuildNIPostCall
BuildNIPost indicates an expected call of BuildNIPost.
func (*MocknipostBuilderMockRecorder) DataDir ¶ added in v1.0.0
func (mr *MocknipostBuilderMockRecorder) DataDir() *nipostBuilderDataDirCall
DataDir indicates an expected call of DataDir.
func (*MocknipostBuilderMockRecorder) UpdatePoETProvers ¶ added in v1.0.0
func (mr *MocknipostBuilderMockRecorder) UpdatePoETProvers(arg0 any) *nipostBuilderUpdatePoETProversCall
UpdatePoETProvers indicates an expected call of UpdatePoETProvers.
type MocknipostValidator ¶ added in v1.0.0
type MocknipostValidator struct {
// contains filtered or unexported fields
}
MocknipostValidator is a mock of nipostValidator interface.
func NewMocknipostValidator ¶ added in v1.0.0
func NewMocknipostValidator(ctrl *gomock.Controller) *MocknipostValidator
NewMocknipostValidator creates a new mock instance.
func (*MocknipostValidator) EXPECT ¶ added in v1.0.0
func (m *MocknipostValidator) EXPECT() *MocknipostValidatorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MocknipostValidator) InitialNIPostChallenge ¶ added in v1.0.0
func (m *MocknipostValidator) InitialNIPostChallenge(challenge *types.NIPostChallenge, atxs atxProvider, goldenATXID types.ATXID) error
InitialNIPostChallenge mocks base method.
func (*MocknipostValidator) NIPost ¶ added in v1.0.0
func (m *MocknipostValidator) NIPost(ctx context.Context, nodeId types.NodeID, atxId types.ATXID, NIPost *types.NIPost, expectedChallenge types.Hash32, numUnits uint32) (uint64, error)
NIPost mocks base method.
func (*MocknipostValidator) NIPostChallenge ¶ added in v1.0.0
func (m *MocknipostValidator) NIPostChallenge(challenge *types.NIPostChallenge, atxs atxProvider, nodeID types.NodeID) error
NIPostChallenge mocks base method.
func (*MocknipostValidator) NumUnits ¶ added in v1.0.0
func (m *MocknipostValidator) NumUnits(cfg *PostConfig, numUnits uint32) error
NumUnits mocks base method.
func (*MocknipostValidator) PositioningAtx ¶ added in v1.0.0
func (m *MocknipostValidator) PositioningAtx(id types.ATXID, atxs atxProvider, goldenATXID types.ATXID, pubepoch types.EpochID) error
PositioningAtx mocks base method.
func (*MocknipostValidator) Post ¶ added in v1.0.0
func (m *MocknipostValidator) Post(ctx context.Context, nodeId types.NodeID, atxId types.ATXID, Post *types.Post, PostMetadata *types.PostMetadata, numUnits uint32) error
Post mocks base method.
func (*MocknipostValidator) PostMetadata ¶ added in v1.0.0
func (m *MocknipostValidator) PostMetadata(cfg *PostConfig, metadata *types.PostMetadata) error
PostMetadata mocks base method.
func (*MocknipostValidator) VRFNonce ¶ added in v1.0.0
func (m *MocknipostValidator) VRFNonce(nodeId types.NodeID, commitmentAtxId types.ATXID, vrfNonce *types.VRFPostIndex, PostMetadata *types.PostMetadata, numUnits uint32) error
VRFNonce mocks base method.
type MocknipostValidatorMockRecorder ¶ added in v1.0.0
type MocknipostValidatorMockRecorder struct {
// contains filtered or unexported fields
}
MocknipostValidatorMockRecorder is the mock recorder for MocknipostValidator.
func (*MocknipostValidatorMockRecorder) InitialNIPostChallenge ¶ added in v1.0.0
func (mr *MocknipostValidatorMockRecorder) InitialNIPostChallenge(challenge, atxs, goldenATXID any) *nipostValidatorInitialNIPostChallengeCall
InitialNIPostChallenge indicates an expected call of InitialNIPostChallenge.
func (*MocknipostValidatorMockRecorder) NIPost ¶ added in v1.0.0
func (mr *MocknipostValidatorMockRecorder) NIPost(ctx, nodeId, atxId, NIPost, expectedChallenge, numUnits any) *nipostValidatorNIPostCall
NIPost indicates an expected call of NIPost.
func (*MocknipostValidatorMockRecorder) NIPostChallenge ¶ added in v1.0.0
func (mr *MocknipostValidatorMockRecorder) NIPostChallenge(challenge, atxs, nodeID any) *nipostValidatorNIPostChallengeCall
NIPostChallenge indicates an expected call of NIPostChallenge.
func (*MocknipostValidatorMockRecorder) NumUnits ¶ added in v1.0.0
func (mr *MocknipostValidatorMockRecorder) NumUnits(cfg, numUnits any) *nipostValidatorNumUnitsCall
NumUnits indicates an expected call of NumUnits.
func (*MocknipostValidatorMockRecorder) PositioningAtx ¶ added in v1.0.0
func (mr *MocknipostValidatorMockRecorder) PositioningAtx(id, atxs, goldenATXID, pubepoch any) *nipostValidatorPositioningAtxCall
PositioningAtx indicates an expected call of PositioningAtx.
func (*MocknipostValidatorMockRecorder) Post ¶ added in v1.0.0
func (mr *MocknipostValidatorMockRecorder) Post(ctx, nodeId, atxId, Post, PostMetadata, numUnits any) *nipostValidatorPostCall
Post indicates an expected call of Post.
func (*MocknipostValidatorMockRecorder) PostMetadata ¶ added in v1.0.0
func (mr *MocknipostValidatorMockRecorder) PostMetadata(cfg, metadata any) *nipostValidatorPostMetadataCall
PostMetadata indicates an expected call of PostMetadata.
func (*MocknipostValidatorMockRecorder) VRFNonce ¶ added in v1.0.0
func (mr *MocknipostValidatorMockRecorder) VRFNonce(nodeId, commitmentAtxId, vrfNonce, PostMetadata, numUnits any) *nipostValidatorVRFNonceCall
VRFNonce indicates an expected call of VRFNonce.
type MockpoetDbAPI ¶ added in v1.0.0
type MockpoetDbAPI struct {
// contains filtered or unexported fields
}
MockpoetDbAPI is a mock of poetDbAPI interface.
func NewMockpoetDbAPI ¶ added in v1.0.0
func NewMockpoetDbAPI(ctrl *gomock.Controller) *MockpoetDbAPI
NewMockpoetDbAPI creates a new mock instance.
func (*MockpoetDbAPI) EXPECT ¶ added in v1.0.0
func (m *MockpoetDbAPI) EXPECT() *MockpoetDbAPIMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockpoetDbAPI) GetProof ¶ added in v1.0.0
func (m *MockpoetDbAPI) GetProof(arg0 types.PoetProofRef) (*types.PoetProof, *types.Hash32, error)
GetProof mocks base method.
func (*MockpoetDbAPI) ValidateAndStore ¶ added in v1.0.0
func (m *MockpoetDbAPI) ValidateAndStore(ctx context.Context, proofMessage *types.PoetProofMessage) error
ValidateAndStore mocks base method.
type MockpoetDbAPIMockRecorder ¶ added in v1.0.0
type MockpoetDbAPIMockRecorder struct {
// contains filtered or unexported fields
}
MockpoetDbAPIMockRecorder is the mock recorder for MockpoetDbAPI.
func (*MockpoetDbAPIMockRecorder) GetProof ¶ added in v1.0.0
func (mr *MockpoetDbAPIMockRecorder) GetProof(arg0 any) *poetDbAPIGetProofCall
GetProof indicates an expected call of GetProof.
func (*MockpoetDbAPIMockRecorder) ValidateAndStore ¶ added in v1.0.0
func (mr *MockpoetDbAPIMockRecorder) ValidateAndStore(ctx, proofMessage any) *poetDbAPIValidateAndStoreCall
ValidateAndStore indicates an expected call of ValidateAndStore.
type MockpostSetupProvider ¶ added in v1.0.0
type MockpostSetupProvider struct {
// contains filtered or unexported fields
}
MockpostSetupProvider is a mock of postSetupProvider interface.
func NewMockpostSetupProvider ¶ added in v1.0.0
func NewMockpostSetupProvider(ctrl *gomock.Controller) *MockpostSetupProvider
NewMockpostSetupProvider creates a new mock instance.
func (*MockpostSetupProvider) Benchmark ¶ added in v1.0.0
func (m *MockpostSetupProvider) Benchmark(p PostSetupProvider) (int, error)
Benchmark mocks base method.
func (*MockpostSetupProvider) CommitmentAtx ¶ added in v1.0.0
func (m *MockpostSetupProvider) CommitmentAtx() (types.ATXID, error)
CommitmentAtx mocks base method.
func (*MockpostSetupProvider) Config ¶ added in v1.0.0
func (m *MockpostSetupProvider) Config() PostConfig
Config mocks base method.
func (*MockpostSetupProvider) EXPECT ¶ added in v1.0.0
func (m *MockpostSetupProvider) EXPECT() *MockpostSetupProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockpostSetupProvider) GenerateProof ¶ added in v1.0.0
func (m *MockpostSetupProvider) GenerateProof(ctx context.Context, challenge []byte, options ...proving.OptionFunc) (*types.Post, *types.PostMetadata, error)
GenerateProof mocks base method.
func (*MockpostSetupProvider) LastOpts ¶ added in v1.0.0
func (m *MockpostSetupProvider) LastOpts() *PostSetupOpts
LastOpts mocks base method.
func (*MockpostSetupProvider) PrepareInitializer ¶ added in v1.0.0
func (m *MockpostSetupProvider) PrepareInitializer(ctx context.Context, opts PostSetupOpts) error
PrepareInitializer mocks base method.
func (*MockpostSetupProvider) Providers ¶ added in v1.0.0
func (m *MockpostSetupProvider) Providers() ([]PostSetupProvider, error)
Providers mocks base method.
func (*MockpostSetupProvider) Reset ¶ added in v1.0.0
func (m *MockpostSetupProvider) Reset() error
Reset mocks base method.
func (*MockpostSetupProvider) StartSession ¶ added in v1.0.0
func (m *MockpostSetupProvider) StartSession(context context.Context) error
StartSession mocks base method.
func (*MockpostSetupProvider) Status ¶ added in v1.0.0
func (m *MockpostSetupProvider) Status() *PostSetupStatus
Status mocks base method.
func (*MockpostSetupProvider) VRFNonce ¶ added in v1.0.0
func (m *MockpostSetupProvider) VRFNonce() (*types.VRFPostIndex, error)
VRFNonce mocks base method.
type MockpostSetupProviderMockRecorder ¶ added in v1.0.0
type MockpostSetupProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockpostSetupProviderMockRecorder is the mock recorder for MockpostSetupProvider.
func (*MockpostSetupProviderMockRecorder) Benchmark ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) Benchmark(p any) *postSetupProviderBenchmarkCall
Benchmark indicates an expected call of Benchmark.
func (*MockpostSetupProviderMockRecorder) CommitmentAtx ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) CommitmentAtx() *postSetupProviderCommitmentAtxCall
CommitmentAtx indicates an expected call of CommitmentAtx.
func (*MockpostSetupProviderMockRecorder) Config ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) Config() *postSetupProviderConfigCall
Config indicates an expected call of Config.
func (*MockpostSetupProviderMockRecorder) GenerateProof ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) GenerateProof(ctx, challenge any, options ...any) *postSetupProviderGenerateProofCall
GenerateProof indicates an expected call of GenerateProof.
func (*MockpostSetupProviderMockRecorder) LastOpts ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) LastOpts() *postSetupProviderLastOptsCall
LastOpts indicates an expected call of LastOpts.
func (*MockpostSetupProviderMockRecorder) PrepareInitializer ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) PrepareInitializer(ctx, opts any) *postSetupProviderPrepareInitializerCall
PrepareInitializer indicates an expected call of PrepareInitializer.
func (*MockpostSetupProviderMockRecorder) Providers ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) Providers() *postSetupProviderProvidersCall
Providers indicates an expected call of Providers.
func (*MockpostSetupProviderMockRecorder) Reset ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) Reset() *postSetupProviderResetCall
Reset indicates an expected call of Reset.
func (*MockpostSetupProviderMockRecorder) StartSession ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) StartSession(context any) *postSetupProviderStartSessionCall
StartSession indicates an expected call of StartSession.
func (*MockpostSetupProviderMockRecorder) Status ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) Status() *postSetupProviderStatusCall
Status indicates an expected call of Status.
func (*MockpostSetupProviderMockRecorder) VRFNonce ¶ added in v1.0.0
func (mr *MockpostSetupProviderMockRecorder) VRFNonce() *postSetupProviderVRFNonceCall
VRFNonce indicates an expected call of VRFNonce.
type Mocksyncer ¶ added in v1.0.0
type Mocksyncer struct {
// contains filtered or unexported fields
}
Mocksyncer is a mock of syncer interface.
func NewMocksyncer ¶ added in v1.0.0
func NewMocksyncer(ctrl *gomock.Controller) *Mocksyncer
NewMocksyncer creates a new mock instance.
func (*Mocksyncer) EXPECT ¶ added in v1.0.0
func (m *Mocksyncer) EXPECT() *MocksyncerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*Mocksyncer) RegisterForATXSynced ¶ added in v1.0.0
func (m *Mocksyncer) RegisterForATXSynced() chan struct{}
RegisterForATXSynced mocks base method.
type MocksyncerMockRecorder ¶ added in v1.0.0
type MocksyncerMockRecorder struct {
// contains filtered or unexported fields
}
MocksyncerMockRecorder is the mock recorder for Mocksyncer.
func (*MocksyncerMockRecorder) RegisterForATXSynced ¶ added in v1.0.0
func (mr *MocksyncerMockRecorder) RegisterForATXSynced() *syncerRegisterForATXSyncedCall
RegisterForATXSynced indicates an expected call of RegisterForATXSynced.
type NIPostBuilder ¶ added in v1.0.0
type NIPostBuilder struct {
// contains filtered or unexported fields
}
NIPostBuilder holds the required state and dependencies to create Non-Interactive Proofs of Space-Time (NIPost).
func NewNIPostBuilder ¶ added in v1.0.0
func NewNIPostBuilder( nodeID types.NodeID, postSetupProvider postSetupProvider, poetDB poetDbAPI, poetServers []string, dataDir string, lg log.Log, signer *signing.EdSigner, poetCfg PoetConfig, layerClock layerClock, opts ...NIPostBuilderOption, ) (*NIPostBuilder, error)
NewNIPostBuilder returns a NIPostBuilder.
func (*NIPostBuilder) BuildNIPost ¶ added in v1.0.0
func (nb *NIPostBuilder) BuildNIPost(ctx context.Context, challenge *types.NIPostChallenge) (*types.NIPost, error)
BuildNIPost uses the given challenge to build a NIPost. The process can take considerable time, because it includes waiting for the poet service to publish a proof - a process that takes about an epoch.
func (*NIPostBuilder) DataDir ¶ added in v1.0.0
func (nb *NIPostBuilder) DataDir() string
func (*NIPostBuilder) UpdatePoETProvers ¶ added in v1.0.0
func (nb *NIPostBuilder) UpdatePoETProvers(poetProvers []PoetProvingServiceClient)
UpdatePoETProvers updates poetProver reference. It should not be executed concurrently with BuildNIPoST.
type NIPostBuilderOption ¶ added in v1.0.3
type NIPostBuilderOption func(*NIPostBuilder)
func WithNipostValidator ¶ added in v1.0.3
func WithNipostValidator(v nipostValidator) NIPostBuilderOption
type OffloadingPostVerifier ¶ added in v1.0.0
type OffloadingPostVerifier struct {
// contains filtered or unexported fields
}
func NewOffloadingPostVerifier ¶ added in v1.0.0
func NewOffloadingPostVerifier(verifiers []PostVerifier, logger log.Log) *OffloadingPostVerifier
NewOffloadingPostVerifier creates a new post proof verifier with the given number of workers. The verifier will distribute incoming proofs between the workers. It will block if all workers are busy.
func (*OffloadingPostVerifier) Close ¶ added in v1.0.0
func (v *OffloadingPostVerifier) Close() error
func (*OffloadingPostVerifier) Verify ¶ added in v1.0.0
func (v *OffloadingPostVerifier) Verify(ctx context.Context, p *shared.Proof, m *shared.ProofMetadata, opts ...verifying.OptionFunc) error
type PoETClientInitializer ¶ added in v1.0.0
type PoETClientInitializer func(string, PoetConfig) (PoetProvingServiceClient, error)
PoETClientInitializer interfaces for creating PoetProvingServiceClient.
type PoetClientOpts ¶ added in v1.0.0
type PoetClientOpts func(*HTTPPoetClient)
func WithLogger ¶ added in v1.1.5
func WithLogger(logger *zap.Logger) PoetClientOpts
type PoetConfig ¶ added in v1.0.0
type PoetConfig struct { PhaseShift time.Duration `mapstructure:"phase-shift"` CycleGap time.Duration `mapstructure:"cycle-gap"` GracePeriod time.Duration `mapstructure:"grace-period"` RequestTimeout time.Duration `mapstructure:"poet-request-timeout"` RequestRetryDelay time.Duration `mapstructure:"retry-delay"` MaxRequestRetries int `mapstructure:"retry-max"` }
PoetConfig is the configuration to interact with the poet server.
func DefaultPoetConfig ¶ added in v1.0.0
func DefaultPoetConfig() PoetConfig
type PoetDb ¶
type PoetDb struct {
// contains filtered or unexported fields
}
PoetDb is a database for PoET proofs.
func (*PoetDb) GetProofMessage ¶
func (db *PoetDb) GetProofMessage(proofRef types.PoetProofRef) ([]byte, error)
GetProofMessage returns the originally received PoET proof message.
func (*PoetDb) GetProofRef ¶ added in v1.0.0
func (*PoetDb) HasProof ¶
func (db *PoetDb) HasProof(proofRef types.PoetProofRef) bool
HasProof returns true if the database contains a proof with the given reference, or false otherwise.
func (*PoetDb) StoreProof ¶ added in v1.0.0
func (db *PoetDb) StoreProof(ctx context.Context, ref types.PoetProofRef, proofMessage *types.PoetProofMessage) error
StoreProof saves the poet proof in local db.
func (*PoetDb) Validate ¶
func (db *PoetDb) Validate(root []byte, proof types.PoetProof, poetID []byte, roundID string, signature types.EdSignature) error
Validate validates a new PoET proof.
func (*PoetDb) ValidateAndStore ¶
ValidateAndStore validates and stores a new PoET proof.
type PoetPoW ¶ added in v1.0.0
type PoetPoW struct { Nonce uint64 Params PoetPowParams }
type PoetPowParams ¶ added in v1.0.0
type PoetProvingServiceClient ¶
type PoetProvingServiceClient interface { Address() string PowParams(ctx context.Context) (*PoetPowParams, error) // Submit registers a challenge in the proving service current open round. Submit(ctx context.Context, deadline time.Time, prefix, challenge []byte, signature types.EdSignature, nodeID types.NodeID, pow PoetPoW) (*types.PoetRound, error) // PoetServiceID returns the public key of the PoET proving service. PoetServiceID(context.Context) (types.PoetServiceID, error) // Proof returns the proof for the given round ID. Proof(ctx context.Context, roundID string) (*types.PoetProofMessage, []types.Member, error) }
PoetProvingServiceClient provides a gateway to a trust-less public proving service, which may serve many PoET proving clients, and thus enormously reduce the cost-per-proof for PoET since each additional proof adds only a small number of hash evaluations to the total cost.
type PoetProvingServiceClientAddressCall ¶ added in v1.1.5
PoetProvingServiceClientAddressCall wrap *gomock.Call
func (*PoetProvingServiceClientAddressCall) Do ¶ added in v1.1.5
func (c *PoetProvingServiceClientAddressCall) Do(f func() string) *PoetProvingServiceClientAddressCall
Do rewrite *gomock.Call.Do
func (*PoetProvingServiceClientAddressCall) DoAndReturn ¶ added in v1.1.5
func (c *PoetProvingServiceClientAddressCall) DoAndReturn(f func() string) *PoetProvingServiceClientAddressCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*PoetProvingServiceClientAddressCall) Return ¶ added in v1.1.5
func (c *PoetProvingServiceClientAddressCall) Return(arg0 string) *PoetProvingServiceClientAddressCall
Return rewrite *gomock.Call.Return
type PoetProvingServiceClientPoetServiceIDCall ¶ added in v1.1.5
PoetProvingServiceClientPoetServiceIDCall wrap *gomock.Call
func (*PoetProvingServiceClientPoetServiceIDCall) Do ¶ added in v1.1.5
func (c *PoetProvingServiceClientPoetServiceIDCall) Do(f func(context.Context) (types.PoetServiceID, error)) *PoetProvingServiceClientPoetServiceIDCall
Do rewrite *gomock.Call.Do
func (*PoetProvingServiceClientPoetServiceIDCall) DoAndReturn ¶ added in v1.1.5
func (c *PoetProvingServiceClientPoetServiceIDCall) DoAndReturn(f func(context.Context) (types.PoetServiceID, error)) *PoetProvingServiceClientPoetServiceIDCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*PoetProvingServiceClientPoetServiceIDCall) Return ¶ added in v1.1.5
func (c *PoetProvingServiceClientPoetServiceIDCall) Return(arg0 types.PoetServiceID, arg1 error) *PoetProvingServiceClientPoetServiceIDCall
Return rewrite *gomock.Call.Return
type PoetProvingServiceClientPowParamsCall ¶ added in v1.1.5
PoetProvingServiceClientPowParamsCall wrap *gomock.Call
func (*PoetProvingServiceClientPowParamsCall) Do ¶ added in v1.1.5
func (c *PoetProvingServiceClientPowParamsCall) Do(f func(context.Context) (*PoetPowParams, error)) *PoetProvingServiceClientPowParamsCall
Do rewrite *gomock.Call.Do
func (*PoetProvingServiceClientPowParamsCall) DoAndReturn ¶ added in v1.1.5
func (c *PoetProvingServiceClientPowParamsCall) DoAndReturn(f func(context.Context) (*PoetPowParams, error)) *PoetProvingServiceClientPowParamsCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*PoetProvingServiceClientPowParamsCall) Return ¶ added in v1.1.5
func (c *PoetProvingServiceClientPowParamsCall) Return(arg0 *PoetPowParams, arg1 error) *PoetProvingServiceClientPowParamsCall
Return rewrite *gomock.Call.Return
type PoetProvingServiceClientProofCall ¶ added in v1.1.5
PoetProvingServiceClientProofCall wrap *gomock.Call
func (*PoetProvingServiceClientProofCall) Do ¶ added in v1.1.5
func (c *PoetProvingServiceClientProofCall) Do(f func(context.Context, string) (*types.PoetProofMessage, []types.Member, error)) *PoetProvingServiceClientProofCall
Do rewrite *gomock.Call.Do
func (*PoetProvingServiceClientProofCall) DoAndReturn ¶ added in v1.1.5
func (c *PoetProvingServiceClientProofCall) DoAndReturn(f func(context.Context, string) (*types.PoetProofMessage, []types.Member, error)) *PoetProvingServiceClientProofCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*PoetProvingServiceClientProofCall) Return ¶ added in v1.1.5
func (c *PoetProvingServiceClientProofCall) Return(arg0 *types.PoetProofMessage, arg1 []types.Member, arg2 error) *PoetProvingServiceClientProofCall
Return rewrite *gomock.Call.Return
type PoetProvingServiceClientSubmitCall ¶ added in v1.1.5
PoetProvingServiceClientSubmitCall wrap *gomock.Call
func (*PoetProvingServiceClientSubmitCall) Do ¶ added in v1.1.5
func (c *PoetProvingServiceClientSubmitCall) Do(f func(context.Context, time.Time, []byte, []byte, types.EdSignature, types.NodeID, PoetPoW) (*types.PoetRound, error)) *PoetProvingServiceClientSubmitCall
Do rewrite *gomock.Call.Do
func (*PoetProvingServiceClientSubmitCall) DoAndReturn ¶ added in v1.1.5
func (c *PoetProvingServiceClientSubmitCall) DoAndReturn(f func(context.Context, time.Time, []byte, []byte, types.EdSignature, types.NodeID, PoetPoW) (*types.PoetRound, error)) *PoetProvingServiceClientSubmitCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*PoetProvingServiceClientSubmitCall) Return ¶ added in v1.1.5
func (c *PoetProvingServiceClientSubmitCall) Return(arg0 *types.PoetRound, arg1 error) *PoetProvingServiceClientSubmitCall
Return rewrite *gomock.Call.Return
type PoetSvcUnstableError ¶ added in v1.0.0
type PoetSvcUnstableError struct {
// contains filtered or unexported fields
}
PoetSvcUnstableError means there was a problem communicating with a Poet service. It wraps the source error.
func (*PoetSvcUnstableError) Error ¶ added in v1.0.0
func (e *PoetSvcUnstableError) Error() string
func (*PoetSvcUnstableError) Is ¶ added in v1.0.0
func (e *PoetSvcUnstableError) Is(target error) bool
func (*PoetSvcUnstableError) Unwrap ¶ added in v1.0.0
func (e *PoetSvcUnstableError) Unwrap() error
type PostConfig ¶ added in v1.0.0
type PostConfig struct { MinNumUnits uint32 `mapstructure:"post-min-numunits"` MaxNumUnits uint32 `mapstructure:"post-max-numunits"` LabelsPerUnit uint64 `mapstructure:"post-labels-per-unit"` K1 uint32 `mapstructure:"post-k1"` K2 uint32 `mapstructure:"post-k2"` K3 uint32 `mapstructure:"post-k3"` PowDifficulty PowDifficulty `mapstructure:"post-pow-difficulty"` }
PostConfig is the configuration of the Post protocol, used for data creation, proofs generation and validation.
func DefaultPostConfig ¶ added in v1.0.0
func DefaultPostConfig() PostConfig
DefaultPostConfig defines the default configuration for Post.
func (PostConfig) ToConfig ¶ added in v1.0.0
func (c PostConfig) ToConfig() config.Config
type PostProofVerifyingOpts ¶ added in v1.0.0
type PostProofVerifyingOpts struct { // Number of workers spawned to verify proofs. Workers int `mapstructure:"smeshing-opts-verifying-workers"` // Flags used for the PoW verification. Flags config.PowFlags `mapstructure:"smeshing-opts-verifying-powflags"` }
PostProvingOpts are the options controlling POST proving process.
func DefaultPostVerifyingOpts ¶ added in v1.0.0
func DefaultPostVerifyingOpts() PostProofVerifyingOpts
type PostProviderID ¶ added in v1.1.0
type PostProviderID struct {
// contains filtered or unexported fields
}
func (*PostProviderID) Set ¶ added in v1.1.0
func (id *PostProviderID) Set(value string) error
Set implements pflag.Value.Set.
func (*PostProviderID) SetInt64 ¶ added in v1.1.0
func (id *PostProviderID) SetInt64(value int64)
SetInt64 sets the value of the PostProviderID to the given int64.
func (*PostProviderID) String ¶ added in v1.1.0
func (id *PostProviderID) String() string
String implements pflag.Value.String.
func (PostProviderID) Type ¶ added in v1.1.0
func (PostProviderID) Type() string
Type implements pflag.Value.Type.
func (*PostProviderID) Value ¶ added in v1.1.0
func (id *PostProviderID) Value() *int64
Value returns the value of the PostProviderID as a pointer to uint32.
type PostProvingOpts ¶ added in v1.0.0
type PostProvingOpts struct { // Number of threads used in POST proving process. Threads uint `mapstructure:"smeshing-opts-proving-threads"` // Number of nonces tried in parallel in POST proving process. Nonces uint `mapstructure:"smeshing-opts-proving-nonces"` // Flags used in the PoW computation. Flags config.PowFlags `mapstructure:"smeshing-opts-proving-powflags"` }
PostProvingOpts are the options controlling POST proving process.
func DefaultPostProvingOpts ¶ added in v1.0.0
func DefaultPostProvingOpts() PostProvingOpts
type PostSetupManager ¶ added in v1.0.0
type PostSetupManager struct {
// contains filtered or unexported fields
}
PostSetupManager implements the PostProvider interface.
func NewPostSetupManager ¶ added in v1.0.0
func NewPostSetupManager(id types.NodeID, cfg PostConfig, logger log.Log, db *datastore.CachedDB, goldenATXID types.ATXID, provingOpts PostProvingOpts) (*PostSetupManager, error)
NewPostSetupManager creates a new instance of PostSetupManager.
func (*PostSetupManager) Benchmark ¶ added in v1.0.0
func (mgr *PostSetupManager) Benchmark(p PostSetupProvider) (int, error)
Benchmark runs a short benchmarking session for a given provider to evaluate its performance.
func (*PostSetupManager) BestProvider ¶ added in v1.0.0
func (mgr *PostSetupManager) BestProvider() (*PostSetupProvider, error)
BestProvider returns the most performant compute provider based on a short benchmarking session.
func (*PostSetupManager) CommitmentAtx ¶ added in v1.0.0
func (mgr *PostSetupManager) CommitmentAtx() (types.ATXID, error)
func (*PostSetupManager) Config ¶ added in v1.0.0
func (mgr *PostSetupManager) Config() PostConfig
Config returns the Post protocol config.
func (*PostSetupManager) GenerateProof ¶ added in v1.0.0
func (mgr *PostSetupManager) GenerateProof(ctx context.Context, challenge []byte, options ...proving.OptionFunc) (*types.Post, *types.PostMetadata, error)
GenerateProof generates a new Post.
func (*PostSetupManager) LastOpts ¶ added in v1.0.0
func (mgr *PostSetupManager) LastOpts() *PostSetupOpts
LastOpts returns the Post setup last session options.
func (*PostSetupManager) PrepareInitializer ¶ added in v1.0.0
func (mgr *PostSetupManager) PrepareInitializer(ctx context.Context, opts PostSetupOpts) error
PrepareInitializer prepares the initializer to begin the initialization process, it needs to be called before each call to StartSession. Having this function be separate from StartSession provides a means to understand if the post configuration is valid before kicking off a very long running task (StartSession can take days to complete). After the first call to this method subsequent calls to this method will return an error until StartSession has completed execution.
func (*PostSetupManager) Providers ¶ added in v1.0.0
func (*PostSetupManager) Providers() ([]PostSetupProvider, error)
Providers returns a list of available compute providers for Post setup.
func (*PostSetupManager) Reset ¶ added in v1.0.0
func (mgr *PostSetupManager) Reset() error
Reset deletes the data file(s).
func (*PostSetupManager) StartSession ¶ added in v1.0.0
func (mgr *PostSetupManager) StartSession(ctx context.Context) error
StartSession starts (or continues) a PoST session. It supports resuming a previously started session, and will return an error if a session is already in progress. It must be ensured that PrepareInitializer is called once before each call to StartSession and that the node is ATX synced.
func (*PostSetupManager) Status ¶ added in v1.0.0
func (mgr *PostSetupManager) Status() *PostSetupStatus
Status returns the setup current status.
func (*PostSetupManager) VRFNonce ¶ added in v1.0.0
func (mgr *PostSetupManager) VRFNonce() (*types.VRFPostIndex, error)
VRFNonce returns the VRF nonce found during initialization.
type PostSetupOpts ¶ added in v1.0.0
type PostSetupOpts struct { DataDir string `mapstructure:"smeshing-opts-datadir"` NumUnits uint32 `mapstructure:"smeshing-opts-numunits"` MaxFileSize uint64 `mapstructure:"smeshing-opts-maxfilesize"` ProviderID PostProviderID `mapstructure:"smeshing-opts-provider"` Throttle bool `mapstructure:"smeshing-opts-throttle"` Scrypt config.ScryptParams `mapstructure:"smeshing-opts-scrypt"` ComputeBatchSize uint64 `mapstructure:"smeshing-opts-compute-batch-size"` }
PostSetupOpts are the options used to initiate a Post setup data creation session, either via the public smesher API, or on node launch (via cmd args).
func DefaultPostSetupOpts ¶ added in v1.0.0
func DefaultPostSetupOpts() PostSetupOpts
DefaultPostSetupOpts defines the default options for Post setup.
func (PostSetupOpts) ToInitOpts ¶ added in v1.0.3
func (o PostSetupOpts) ToInitOpts() config.InitOpts
type PostSetupProvider ¶ added in v1.0.0
type PostSetupProvider initialization.Provider
PostSetupProvider represent a compute provider for Post setup data creation.
type PostSetupState ¶ added in v1.0.0
type PostSetupState int32
const ( PostSetupStateNotStarted PostSetupState = 1 + iota PostSetupStatePrepared PostSetupStateInProgress PostSetupStateStopped PostSetupStateComplete PostSetupStateError )
type PostSetupStatus ¶ added in v1.0.0
type PostSetupStatus struct { State PostSetupState NumLabelsWritten uint64 LastOpts *PostSetupOpts }
PostSetupStatus represents a status snapshot of the Post setup.
type PostVerifier ¶ added in v1.0.0
type PostVerifier interface { io.Closer Verify(ctx context.Context, p *shared.Proof, m *shared.ProofMetadata, opts ...verifying.OptionFunc) error }
func NewPostVerifier ¶ added in v1.0.0
func NewPostVerifier(cfg PostConfig, logger log.Log, opts ...verifying.OptionFunc) (PostVerifier, error)
NewPostVerifier creates a new post verifier.
type PostVerifierCloseCall ¶ added in v1.1.5
PostVerifierCloseCall wrap *gomock.Call
func (*PostVerifierCloseCall) Do ¶ added in v1.1.5
func (c *PostVerifierCloseCall) Do(f func() error) *PostVerifierCloseCall
Do rewrite *gomock.Call.Do
func (*PostVerifierCloseCall) DoAndReturn ¶ added in v1.1.5
func (c *PostVerifierCloseCall) DoAndReturn(f func() error) *PostVerifierCloseCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*PostVerifierCloseCall) Return ¶ added in v1.1.5
func (c *PostVerifierCloseCall) Return(arg0 error) *PostVerifierCloseCall
Return rewrite *gomock.Call.Return
type PostVerifierVerifyCall ¶ added in v1.1.5
PostVerifierVerifyCall wrap *gomock.Call
func (*PostVerifierVerifyCall) Do ¶ added in v1.1.5
func (c *PostVerifierVerifyCall) Do(f func(context.Context, *shared.Proof, *shared.ProofMetadata, ...verifying.OptionFunc) error) *PostVerifierVerifyCall
Do rewrite *gomock.Call.Do
func (*PostVerifierVerifyCall) DoAndReturn ¶ added in v1.1.5
func (c *PostVerifierVerifyCall) DoAndReturn(f func(context.Context, *shared.Proof, *shared.ProofMetadata, ...verifying.OptionFunc) error) *PostVerifierVerifyCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*PostVerifierVerifyCall) Return ¶ added in v1.1.5
func (c *PostVerifierVerifyCall) Return(arg0 error) *PostVerifierVerifyCall
Return rewrite *gomock.Call.Return
type PowDifficulty ¶ added in v1.0.0
type PowDifficulty [32]byte
func (*PowDifficulty) Set ¶ added in v1.0.0
func (f *PowDifficulty) Set(value string) error
Set implements pflag.Value.Set.
func (PowDifficulty) String ¶ added in v1.0.0
func (d PowDifficulty) String() string
func (PowDifficulty) Type ¶ added in v1.0.0
func (PowDifficulty) Type() string
Type implements pflag.Value.Type.
func (*PowDifficulty) UnmarshalText ¶ added in v1.0.0
func (d *PowDifficulty) UnmarshalText(text []byte) error
type SmeshingProvider ¶ added in v1.0.0
type SmeshingProvider interface { Smeshing() bool StartSmeshing(types.Address, PostSetupOpts) error StopSmeshing(bool) error SmesherID() types.NodeID Coinbase() types.Address SetCoinbase(coinbase types.Address) UpdatePoETServers(ctx context.Context, endpoints []string) error }
SmeshingProvider defines the functionality required for the node's Smesher API.
type SmeshingProviderCoinbaseCall ¶ added in v1.1.5
SmeshingProviderCoinbaseCall wrap *gomock.Call
func (*SmeshingProviderCoinbaseCall) Do ¶ added in v1.1.5
func (c *SmeshingProviderCoinbaseCall) Do(f func() types.Address) *SmeshingProviderCoinbaseCall
Do rewrite *gomock.Call.Do
func (*SmeshingProviderCoinbaseCall) DoAndReturn ¶ added in v1.1.5
func (c *SmeshingProviderCoinbaseCall) DoAndReturn(f func() types.Address) *SmeshingProviderCoinbaseCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*SmeshingProviderCoinbaseCall) Return ¶ added in v1.1.5
func (c *SmeshingProviderCoinbaseCall) Return(arg0 types.Address) *SmeshingProviderCoinbaseCall
Return rewrite *gomock.Call.Return
type SmeshingProviderSetCoinbaseCall ¶ added in v1.1.5
SmeshingProviderSetCoinbaseCall wrap *gomock.Call
func (*SmeshingProviderSetCoinbaseCall) Do ¶ added in v1.1.5
func (c *SmeshingProviderSetCoinbaseCall) Do(f func(types.Address)) *SmeshingProviderSetCoinbaseCall
Do rewrite *gomock.Call.Do
func (*SmeshingProviderSetCoinbaseCall) DoAndReturn ¶ added in v1.1.5
func (c *SmeshingProviderSetCoinbaseCall) DoAndReturn(f func(types.Address)) *SmeshingProviderSetCoinbaseCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*SmeshingProviderSetCoinbaseCall) Return ¶ added in v1.1.5
func (c *SmeshingProviderSetCoinbaseCall) Return() *SmeshingProviderSetCoinbaseCall
Return rewrite *gomock.Call.Return
type SmeshingProviderSmesherIDCall ¶ added in v1.1.5
SmeshingProviderSmesherIDCall wrap *gomock.Call
func (*SmeshingProviderSmesherIDCall) Do ¶ added in v1.1.5
func (c *SmeshingProviderSmesherIDCall) Do(f func() types.NodeID) *SmeshingProviderSmesherIDCall
Do rewrite *gomock.Call.Do
func (*SmeshingProviderSmesherIDCall) DoAndReturn ¶ added in v1.1.5
func (c *SmeshingProviderSmesherIDCall) DoAndReturn(f func() types.NodeID) *SmeshingProviderSmesherIDCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*SmeshingProviderSmesherIDCall) Return ¶ added in v1.1.5
func (c *SmeshingProviderSmesherIDCall) Return(arg0 types.NodeID) *SmeshingProviderSmesherIDCall
Return rewrite *gomock.Call.Return
type SmeshingProviderSmeshingCall ¶ added in v1.1.5
SmeshingProviderSmeshingCall wrap *gomock.Call
func (*SmeshingProviderSmeshingCall) Do ¶ added in v1.1.5
func (c *SmeshingProviderSmeshingCall) Do(f func() bool) *SmeshingProviderSmeshingCall
Do rewrite *gomock.Call.Do
func (*SmeshingProviderSmeshingCall) DoAndReturn ¶ added in v1.1.5
func (c *SmeshingProviderSmeshingCall) DoAndReturn(f func() bool) *SmeshingProviderSmeshingCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*SmeshingProviderSmeshingCall) Return ¶ added in v1.1.5
func (c *SmeshingProviderSmeshingCall) Return(arg0 bool) *SmeshingProviderSmeshingCall
Return rewrite *gomock.Call.Return
type SmeshingProviderStartSmeshingCall ¶ added in v1.1.5
SmeshingProviderStartSmeshingCall wrap *gomock.Call
func (*SmeshingProviderStartSmeshingCall) Do ¶ added in v1.1.5
func (c *SmeshingProviderStartSmeshingCall) Do(f func(types.Address, PostSetupOpts) error) *SmeshingProviderStartSmeshingCall
Do rewrite *gomock.Call.Do
func (*SmeshingProviderStartSmeshingCall) DoAndReturn ¶ added in v1.1.5
func (c *SmeshingProviderStartSmeshingCall) DoAndReturn(f func(types.Address, PostSetupOpts) error) *SmeshingProviderStartSmeshingCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*SmeshingProviderStartSmeshingCall) Return ¶ added in v1.1.5
func (c *SmeshingProviderStartSmeshingCall) Return(arg0 error) *SmeshingProviderStartSmeshingCall
Return rewrite *gomock.Call.Return
type SmeshingProviderStopSmeshingCall ¶ added in v1.1.5
SmeshingProviderStopSmeshingCall wrap *gomock.Call
func (*SmeshingProviderStopSmeshingCall) Do ¶ added in v1.1.5
func (c *SmeshingProviderStopSmeshingCall) Do(f func(bool) error) *SmeshingProviderStopSmeshingCall
Do rewrite *gomock.Call.Do
func (*SmeshingProviderStopSmeshingCall) DoAndReturn ¶ added in v1.1.5
func (c *SmeshingProviderStopSmeshingCall) DoAndReturn(f func(bool) error) *SmeshingProviderStopSmeshingCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*SmeshingProviderStopSmeshingCall) Return ¶ added in v1.1.5
func (c *SmeshingProviderStopSmeshingCall) Return(arg0 error) *SmeshingProviderStopSmeshingCall
Return rewrite *gomock.Call.Return
type SmeshingProviderUpdatePoETServersCall ¶ added in v1.1.5
SmeshingProviderUpdatePoETServersCall wrap *gomock.Call
func (*SmeshingProviderUpdatePoETServersCall) Do ¶ added in v1.1.5
func (c *SmeshingProviderUpdatePoETServersCall) Do(f func(context.Context, []string) error) *SmeshingProviderUpdatePoETServersCall
Do rewrite *gomock.Call.Do
func (*SmeshingProviderUpdatePoETServersCall) DoAndReturn ¶ added in v1.1.5
func (c *SmeshingProviderUpdatePoETServersCall) DoAndReturn(f func(context.Context, []string) error) *SmeshingProviderUpdatePoETServersCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*SmeshingProviderUpdatePoETServersCall) Return ¶ added in v1.1.5
func (c *SmeshingProviderUpdatePoETServersCall) Return(arg0 error) *SmeshingProviderUpdatePoETServersCall
Return rewrite *gomock.Call.Return
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator contains the dependencies required to validate NIPosts.
func NewValidator ¶
func NewValidator(poetDb poetDbAPI, cfg PostConfig, scrypt config.ScryptParams, log log.Log, postVerifier PostVerifier) *Validator
NewValidator returns a new NIPost validator.
func (*Validator) InitialNIPostChallenge ¶ added in v1.0.0
func (*Validator) NIPost ¶ added in v1.0.0
func (v *Validator) NIPost(ctx context.Context, nodeId types.NodeID, commitmentAtxId types.ATXID, nipost *types.NIPost, expectedChallenge types.Hash32, numUnits uint32) (uint64, error)
NIPost validates a NIPost, given a node id and expected challenge. It returns an error if the NIPost is invalid.
Some of the Post metadata fields validation values is ought to eventually be derived from consensus instead of local configuration. If so, their validation should be removed to contextual validation, while still syntactically-validate them here according to locally configured min/max values.
func (*Validator) NIPostChallenge ¶ added in v1.0.0
func (*Validator) NumUnits ¶ added in v1.0.0
func (*Validator) NumUnits(cfg *PostConfig, numUnits uint32) error
func (*Validator) PositioningAtx ¶ added in v1.0.0
func (*Validator) Post ¶ added in v1.0.0
func (v *Validator) Post(ctx context.Context, nodeId types.NodeID, commitmentAtxId types.ATXID, PoST *types.Post, PostMetadata *types.PostMetadata, numUnits uint32) error
Post validates a Proof of Space-Time (PoST). It returns nil if validation passed or an error indicating why validation failed.
func (*Validator) PostMetadata ¶ added in v1.0.0
func (*Validator) PostMetadata(cfg *PostConfig, metadata *types.PostMetadata) error