Documentation
¶
Index ¶
- Constants
- func Contract(ctx context.Context, prm ContractPrm) (util.Uint160, error)
- func Deploy(ctx context.Context, prm Prm) error
- type AlphabetContractPrm
- type AuditContractPrm
- type BalanceContractPrm
- type Blockchain
- type CommonDeployPrm
- type ContainerContractPrm
- type ContractPrm
- type NNSPrm
- type NetmapContractPrm
- type NetworkConfiguration
- type Prm
- type ProxyContractPrm
- type RawNetworkParameter
- type ReputationContractPrm
- type WitnessSet
Constants ¶
const ( MaxObjectSizeConfig = "MaxObjectSize" BasicIncomeRateConfig = "BasicIncomeRate" AuditFeeConfig = "AuditFee" EpochDurationConfig = "EpochDuration" ContainerFeeConfig = "ContainerFee" ContainerAliasFeeConfig = "ContainerAliasFee" EigenTrustIterationsConfig = "EigenTrustIterations" EigenTrustAlphaConfig = "EigenTrustAlpha" InnerRingCandidateFeeConfig = "InnerRingCandidateFee" WithdrawFeeConfig = "WithdrawFee" HomomorphicHashingDisabledKey = "HomomorphicHashingDisabled" MaintenanceModeAllowedConfig = "MaintenanceModeAllowed" )
Variables ¶
This section is empty.
Functions ¶
func Deploy ¶
Deploy initializes Neo network represented by given Prm.Blockchain as FS chain 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:
- NNS contract deployment
- launch of a notary service for the committee
- initial GAS distribution between committee members
- Alphabet initialization (incl. registration as candidates to validators)
- deployment/update of the NeoFS system contracts
- distribution of all available NEO between the Alphabet contracts
See project documentation for details.
Types ¶
type AlphabetContractPrm ¶
type AlphabetContractPrm struct {
Common CommonDeployPrm
}
AlphabetContractPrm groups deployment parameters of the NeoFS Alphabet contract.
type AuditContractPrm ¶
type AuditContractPrm struct {
Common CommonDeployPrm
}
AuditContractPrm groups deployment parameters of the NeoFS Audit contract.
type BalanceContractPrm ¶
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)
// SubscribeToNewHeaders opens stream of the new headers 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.
SubscribeToNewHeaders() (<-chan *block.Header, 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 FS chain that are required for its deployment.
type CommonDeployPrm ¶
CommonDeployPrm groups common deployment parameters of the smart contract.
type ContainerContractPrm ¶
type ContainerContractPrm struct {
Common CommonDeployPrm
}
ContainerContractPrm groups deployment parameters of the Container contract.
type ContractPrm ¶
type ContractPrm struct {
// Writes progress into the log.
Logger *zap.Logger
// Particular Neo blockchain instance to be used as FS chain.
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
// NNSContractAddress contains address of NNS contract in chain.
NNSContractAddress util.Uint160
// NNSContractAddress contains address of Proxy contract in chain.
ProxyContractAddress util.Uint160
// SystemEmail which will be set to NNS record after contract deploy.
SystemEmail string
// DomainName for the deploying contract.
DomainName string
// NEFFile for deploying contract.
NEFFile nef.File
// ManifestFile for deploying contract (json).
ManifestFile manifest.Manifest
// DesignatedDeployer is a deployer account for case when contracts deploys by another node.
DesignatedDeployer *util.Uint160
// DeployWitness allows to configure witnesses.
// 0: committee witness is not needed
// [WitnessValidators]: committee 2/3n+1 with validatorsDeployAllowedContracts
// [WitnessValidatorsAndCommittee]: [WitnessValidators] + committee n/2+1 with allowed NNS contract calls
DeployWitness WitnessSet
// BuildExtraDeployArgs allows to pass extra parameters to deployment routine.
BuildExtraDeployArgs func() ([]any, error)
}
ContractPrm describes parameters required to configure user's contract deployment routine.
type NNSPrm ¶
type NNSPrm struct {
Common CommonDeployPrm
SystemEmail string
}
NNSPrm groups deployment parameters of the NeoFS NNS contract.
type NetmapContractPrm ¶
type NetmapContractPrm struct {
Common CommonDeployPrm
Config NetworkConfiguration
}
NetmapContractPrm groups deployment parameters of the Netmap contract.
type NetworkConfiguration ¶
type NetworkConfiguration struct {
MaxObjectSize uint64
StoragePrice uint64
AuditFee uint64
EpochDuration uint64
ContainerFee uint64
ContainerAliasFee uint64
EigenTrustIterations uint64
EigenTrustAlpha float64
IRCandidateFee uint64
WithdrawalFee uint64
HomomorphicHashingDisabled bool
MaintenanceModeAllowed bool
Raw []RawNetworkParameter
}
NetworkConfiguration represents NeoFS network configuration stored in FS chain.
type Prm ¶
type Prm struct {
// Writes progress into the log.
Logger *zap.Logger
// Particular Neo blockchain instance to be used as FS chain.
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
NetmapContract NetmapContractPrm
ProxyContract ProxyContractPrm
ReputationContract ReputationContractPrm
}
Prm groups all parameters of the FS chain deployment procedure.
type ProxyContractPrm ¶
type ProxyContractPrm struct {
Common CommonDeployPrm
}
ProxyContractPrm groups deployment parameters of the NeoFS Proxy contract.
type RawNetworkParameter ¶
type RawNetworkParameter struct {
// Name of the parameter.
Name string
// Raw parameter value.
Value []byte
}
RawNetworkParameter is a NeoFS network parameter which is transmitted but not interpreted by the NeoFS API protocol.
type ReputationContractPrm ¶
type ReputationContractPrm struct {
Common CommonDeployPrm
}
ReputationContractPrm groups deployment parameters of the NeoFS Reputation contract.
type WitnessSet ¶
type WitnessSet uint8
WitnessSet type describes witnesses for contract.
const ( // WitnessValidators requires committee 2/3n+1. WitnessValidators WitnessSet // WitnessValidatorsAndCommittee requires WitnessValidators + committee n/2+1 with allowed NNS contract calls. WitnessValidatorsAndCommittee )