deploy

package
v0.39.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 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. initial GAS distribution between committee members
  4. Alphabet initialization (incl. registration as candidates to validators)
  5. deployment/update of the NeoFS system contracts
  6. distribution of all available NEO between the Alphabet contracts

See project documentation for details.

Types

type AlphabetContractPrm added in v0.39.0

type AlphabetContractPrm struct {
	Common CommonDeployPrm
}

AlphabetContractPrm groups deployment parameters of the NeoFS Alphabet contract.

type AuditContractPrm added in v0.39.0

type AuditContractPrm struct {
	Common CommonDeployPrm
}

AuditContractPrm groups deployment parameters of the NeoFS Audit contract.

type BalanceContractPrm added in v0.39.0

type BalanceContractPrm struct {
	Common CommonDeployPrm
}

BalanceContractPrm groups deployment parameters of the NeoFS Balance contract.

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)

	// GetContractStateByHash is similar to GetContractStateByID but accepts address.
	// GetContractStateByHash may return non-nil state.Contract along with an error.
	GetContractStateByHash(util.Uint160) (*state.Contract, error)

	// SubscribeToNewBlocks opens stream of the new blocks persisted in the
	// blockchain and returns channel to read them. The channel is closed only when
	// connection to the blockchain is lost and there will be no more events. Caller
	// subscribes once, regularly reads events from the channel and is resistant to
	// event replay.
	SubscribeToNewBlocks() (<-chan *block.Block, error)

	// SubscribeToNotaryRequests opens stream of the notary request events from the
	// blockchain and returns channel to read them. The channel is closed only when
	// connection to the blockchain is lost and there will be no more events. Caller
	// subscribes once, regularly reads events from the channel and is resistant to
	// event replay.
	SubscribeToNotaryRequests() (<-chan *result.NotaryRequestEvent, 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 ContainerContractPrm added in v0.39.0

type ContainerContractPrm struct {
	Common CommonDeployPrm
}

ContainerContractPrm groups deployment parameters of the Container contract.

type NNSPrm

type NNSPrm struct {
	Common      CommonDeployPrm
	SystemEmail string
}

NNSPrm groups deployment parameters of the NeoFS NNS contract.

type NeoFSIDContractPrm added in v0.39.0

type NeoFSIDContractPrm struct {
	Common CommonDeployPrm
}

NeoFSIDContractPrm groups deployment parameters of the NeoFS ID contract.

type NetmapContractPrm added in v0.39.0

type NetmapContractPrm struct {
	Common CommonDeployPrm
	Config netmap.NetworkConfiguration
}

NetmapContractPrm groups deployment parameters of the Netmap 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

	// Validator multi-sig account to spread initial GAS to network
	// participants (must be unlocked).
	ValidatorMultiSigAccount *wallet.Account

	NNS NNSPrm

	AlphabetContract   AlphabetContractPrm
	AuditContract      AuditContractPrm
	BalanceContract    BalanceContractPrm
	ContainerContract  ContainerContractPrm
	NeoFSIDContract    NeoFSIDContractPrm
	NetmapContract     NetmapContractPrm
	ProxyContract      ProxyContractPrm
	ReputationContract ReputationContractPrm
}

Prm groups all parameters of the NeoFS Sidechain deployment procedure.

type ProxyContractPrm added in v0.39.0

type ProxyContractPrm struct {
	Common CommonDeployPrm
}

ProxyContractPrm groups deployment parameters of the NeoFS Proxy contract.

type ReputationContractPrm added in v0.39.0

type ReputationContractPrm struct {
	Common CommonDeployPrm
}

ReputationContractPrm groups deployment parameters of the NeoFS Reputation contract.

Jump to

Keyboard shortcuts

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