deploy

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: GPL-3.0 Imports: 50 Imported by: 0

Documentation

Overview

Package deploy provides NeoFS Sidechain deployment functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deploy

func Deploy(ctx context.Context, prm Prm) error

Deploy initializes Neo network represented by given Prm.Blockchain as NeoFS Sidechain and makes it full-featured for NeoFS storage system operation.

Deploy aborts only by context or when a fatal error occurs. Deployment progress is logged in detail. It is expected that some situations can be changed/fixed on the chain from the outside, so Deploy adapts flexibly and does not stop at the moment.

Deployment process is detailed in NeoFS docs. Summary of stages:

  1. NNS contract deployment
  2. launch of a notary service for the committee
  3. committee group initialization
  4. deployment/update of the NeoFS system contracts (currently only NNS)
  5. deployment of custom contracts

See project documentation for details.

Types

type Blockchain

type Blockchain interface {
	// RPCActor groups functions needed to compose and send transactions (incl.
	// Notary service requests) to the blockchain.
	notary.RPCActor

	// GetCommittee returns list of public keys owned by Neo blockchain committee
	// members. Resulting list is non-empty, unique and unsorted.
	GetCommittee() (keys.PublicKeys, error)

	// GetContractStateByID returns network state of the smart contract by its ID.
	// GetContractStateByID returns error with 'Unknown contract' substring if
	// requested contract is missing.
	GetContractStateByID(id int32) (*state.Contract, error)

	// ReceiveBlocks starts background process that forwards new blocks of the
	// blockchain to the provided channel. The process handles all new blocks when
	// ReceiveBlocks is called with nil filter. Returns unique identifier to be used
	// to stop the process via Unsubscribe.
	ReceiveBlocks(*neorpc.BlockFilter, chan<- *block.Block) (id string, err error)

	// ReceiveNotaryRequests starts background process that forwards new notary
	// requests of the blockchain to the provided channel. The process skips
	// requests that don't match specified filter. Returns unique identifier to be
	// used to stop the process via Unsubscribe.
	ReceiveNotaryRequests(*neorpc.TxFilter, chan<- *result.NotaryRequestEvent) (string, error)

	// Unsubscribe stops background process started by ReceiveBlocks or
	// ReceiveNotaryRequests by ID.
	Unsubscribe(id string) error
}

Blockchain groups services provided by particular Neo blockchain network representing NeoFS Sidechain that are required for its deployment.

type CommonDeployPrm

type CommonDeployPrm struct {
	NEF      nef.File
	Manifest manifest.Manifest
}

CommonDeployPrm groups common deployment parameters of the smart contract.

type KeyStorage

type KeyStorage interface {
	// GetPersistedPrivateKey returns singleton private key persisted in the
	// storage. GetPersistedPrivateKey randomizes the key initially. All subsequent
	// successful calls return the same key.
	GetPersistedPrivateKey() (*keys.PrivateKey, error)
}

KeyStorage represents storage of the private keys.

type NNSPrm

type NNSPrm struct {
	Common      CommonDeployPrm
	SystemEmail string
}

NNSPrm groups deployment parameters of the NeoFS NNS contract.

type Prm

type Prm struct {
	// Writes progress into the log.
	Logger *zap.Logger

	// Particular Neo blockchain instance to be used as NeoFS Sidechain.
	Blockchain Blockchain

	// Local process account used for transaction signing (must be unlocked).
	LocalAccount *wallet.Account

	// Storage for single committee group key.
	KeyStorage KeyStorage

	NNS NNSPrm
}

Prm groups all parameters of the NeoFS Sidechain deployment procedure.

Jump to

Keyboard shortcuts

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