genesis

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DNSType = "dns"

DNSType defines the constant used when checking if a smart contract is of dns type

View Source
const DelegationType = "delegation"

DelegationType defines the constant used when checking if a smart contract is of delegation type

Variables

View Source
var ErrAccountAlreadyExists = errors.New("account already exists")

ErrAccountAlreadyExists signals that an account already exists

View Source
var ErrAccountNotCreated = errors.New("account not created")

ErrAccountNotCreated signals that an account could not have been created

View Source
var ErrAddressIsSmartContract = errors.New("address is a smart contract")

ErrAddressIsSmartContract signals that provided address is of type smart contract

View Source
var ErrBLSKeyNotStaked = errors.New("bls key not staked")

ErrBLSKeyNotStaked signals that bls staking was not successful

View Source
var ErrChangeOwnerAddressFailed = errors.New("change owner address failed")

ErrChangeOwnerAddressFailed signals that change owner address failed

View Source
var ErrDelegationValueIsNotEnough = errors.New("delegation value is not enough")

ErrDelegationValueIsNotEnough signals that the delegation value provided is not enough for provided node(s)

View Source
var ErrDuplicateAddress = errors.New("duplicate address")

ErrDuplicateAddress signals that the same address was found more than one time

View Source
var ErrEmptyAddress = errors.New("empty address")

ErrEmptyAddress signals that an empty address was found in genesis file

View Source
var ErrEmptyDelegationAddress = errors.New("empty delegation address")

ErrEmptyDelegationAddress signals that the delegation address is empty

View Source
var ErrEmptyOwnerAddress = errors.New("empty owner address")

ErrEmptyOwnerAddress signals that an empty owner address was found in genesis file

View Source
var ErrEmptyPubKey = errors.New("empty public key")

ErrEmptyPubKey signals that empty public key has been provided

View Source
var ErrEmptyReturnData = errors.New("empty return data")

ErrEmptyReturnData signals an empty return data from vmOutput was received

View Source
var ErrEmptyVmType = errors.New("empty vm type")

ErrEmptyVmType signals that the provided VM type is empty

View Source
var ErrEntireSupplyMismatch = errors.New("entire supply mismatch")

ErrEntireSupplyMismatch signals that the provided entire supply mismatches the computed one

View Source
var ErrFilenameIsDirectory = errors.New("provided name is actually a directory")

ErrFilenameIsDirectory signals that the provided filename is a directory

View Source
var ErrGetVersionFromSC = errors.New("get version from contract returned an invalid response")

ErrGetVersionFromSC signals that a call to "version" function on a contract resulted in an unexpected result

View Source
var ErrInvalidAddress = errors.New("invalid address")

ErrInvalidAddress signals that an invalid address was found

View Source
var ErrInvalidBalance = errors.New("invalid balance")

ErrInvalidBalance signals that the balance field is invalid

View Source
var ErrInvalidBalanceString = errors.New("invalid balance string")

ErrInvalidBalanceString signals that the balance string is not a valid number

View Source
var ErrInvalidDelegationAddress = errors.New("invalid delegation address")

ErrInvalidDelegationAddress signals that the delegation address is invalid

View Source
var ErrInvalidDelegationValue = errors.New("invalid delegation value")

ErrInvalidDelegationValue signals that the delegation value field is invalid

View Source
var ErrInvalidDelegationValueString = errors.New("invalid delegation value string")

ErrInvalidDelegationValueString signals that the delegation balance string is not a valid number

View Source
var ErrInvalidEntireSupply = errors.New("invalid entire supply")

ErrInvalidEntireSupply signals that the provided entire supply is invalid

View Source
var ErrInvalidInitialNodePrice = errors.New("invalid initial node price")

ErrInvalidInitialNodePrice signals that the provided initial node price is invalid

View Source
var ErrInvalidOwnerAddress = errors.New("invalid owner address")

ErrInvalidOwnerAddress signals that an invalid owner address was found

View Source
var ErrInvalidPubKey = errors.New("invalid public key")

ErrInvalidPubKey signals that an invalid public key has been provided

View Source
var ErrInvalidStakingBalance = errors.New("invalid staking balance")

ErrInvalidStakingBalance signals that the staking balance field is invalid

View Source
var ErrInvalidStakingBalanceString = errors.New("invalid staking balance string")

ErrInvalidStakingBalanceString signals that the staking balance string is not a valid number

View Source
var ErrInvalidSupply = errors.New("invalid supply")

ErrInvalidSupply signals that the supply field is invalid

View Source
var ErrInvalidSupplyString = errors.New("invalid supply string")

ErrInvalidSupplyString signals that the supply string is not a valid number

View Source
var ErrInvalidVmType = errors.New("invalid vm type")

ErrInvalidVmType signals that the provided VM type is invalid

View Source
var ErrMissingDeployedSC = errors.New("missing deployed SC")

ErrMissingDeployedSC signals that a delegation referenced an un-deployed contract

View Source
var ErrNilAccountsParser = errors.New("nil accounts parser")

ErrNilAccountsParser signals that the provided accounts parser is nil

View Source
var ErrNilDelegationHandler = errors.New("nil delegation handler")

ErrNilDelegationHandler signals that a nil delegation handler has been used

View Source
var ErrNilEntireSupply = errors.New("nil entire supply")

ErrNilEntireSupply signals that the provided entire supply is nil

View Source
var ErrNilEpochConfig = errors.New("nil epoch config")

ErrNilEpochConfig signals that a nil epoch config was provided

View Source
var ErrNilGeneralSettingsConfig = errors.New("nil general settings config")

ErrNilGeneralSettingsConfig signals that a nil general settings config was provided

View Source
var ErrNilHasher = errors.New("nil Hasher")

ErrNilHasher signals that an operation has been attempted to or with a nil hasher implementation

View Source
var ErrNilInitialNodePrice = errors.New("nil initial node price")

ErrNilInitialNodePrice signals that the provided initial node price is nil

View Source
var ErrNilKeyGenerator = errors.New("nil key generator")

ErrNilKeyGenerator signals that nil key generator has been provided

View Source
var ErrNilMarshalizer = errors.New("nil Marshalizer")

ErrNilMarshalizer signals that an operation has been attempted to or with a nil Marshalizer implementation

View Source
var ErrNilNodesListSplitter = errors.New("nil nodes list splitter")

ErrNilNodesListSplitter signals that a nil nodes handler has been provided

View Source
var ErrNilNodesSetup = errors.New("nil nodes setup")

ErrNilNodesSetup signals that a nil nodes setup handler has been provided

View Source
var ErrNilPubkeyConverter = errors.New("nil pubkey converter")

ErrNilPubkeyConverter signals that the provided public key converter is nil

View Source
var ErrNilQueryService = errors.New("nil query service")

ErrNilQueryService signals that a nil query service has been provided

View Source
var ErrNilShardCoordinator = errors.New("nil shard coordinator")

ErrNilShardCoordinator signals that the provided shard coordinator is nil

View Source
var ErrNilSmartContractParser = errors.New("nil smart contract parser")

ErrNilSmartContractParser signals that the smart contract parser is nil

View Source
var ErrNilTrieStorageManager = errors.New("nil trie storage manager")

ErrNilTrieStorageManager signals that a nil trie storage manager has been provided

View Source
var ErrNilTxExecutionProcessor = errors.New("nil tx execution processor")

ErrNilTxExecutionProcessor signals that a nil tx execution processor has been provided

View Source
var ErrNodeNotStaked = errors.New("for the provided node, no one staked")

ErrNodeNotStaked signals that no one staked for the provided node

View Source
var ErrSignatureMismatch = errors.New("signature mismatch")

ErrSignatureMismatch signals a signature mismatch occurred

View Source
var ErrSmartContractWasNotDeployed = errors.New("smart contract was not deployed")

ErrSmartContractWasNotDeployed signals that smart contract was not deployed

View Source
var ErrStakingValueIsNotEnough = errors.New("staking value is not enough")

ErrStakingValueIsNotEnough signals that the staking value provided is not enough for provided node(s)

View Source
var ErrSupplyMismatch = errors.New("supply value mismatch")

ErrSupplyMismatch signals that the supply value provided is not valid when summing the other fields

View Source
var ErrTooManyDNSContracts = errors.New("too many DNS contracts")

ErrTooManyDNSContracts signals that too many DNS contracts are in genesis contracts json file

View Source
var ErrWhileVerifyingDelegation = errors.New("error occurred while verifying delegation SC")

ErrWhileVerifyingDelegation signals that a verification error occurred

View Source
var ErrWrongTypeAssertion = errors.New("wrong type assertion")

ErrWrongTypeAssertion signals that a wrong type assertion occurred

View Source
var InitialDNSAddress = bytes.Repeat([]byte{1}, 32)

InitialDNSAddress defines the initial address from where the DNS contracts are deployed

Functions

This section is empty.

Types

type AccountsParser

type AccountsParser interface {
	InitialAccountsSplitOnAddressesShards(shardCoordinator sharding.Coordinator) (map[uint32][]InitialAccountHandler, error)
	InitialAccounts() []InitialAccountHandler
	GenesisMintingAddress() string
	GetTotalStakedForDelegationAddress(delegationAddress string) *big.Int
	GetInitialAccountsForDelegated(addressBytes []byte) []InitialAccountHandler
	GenerateInitialTransactions(shardCoordinator sharding.Coordinator, initialIndexingData map[uint32]*IndexingData) ([]*block.MiniBlock, map[uint32]*outport.Pool, error)
	IsInterfaceNil() bool
}

AccountsParser contains the parsed genesis json file and has some functionality regarding processed data

type AccountsParserArgs

type AccountsParserArgs struct {
	GenesisFilePath string
	EntireSupply    *big.Int
	MinterAddress   string
	PubkeyConverter core.PubkeyConverter
	KeyGenerator    crypto.KeyGenerator
	Hasher          hashing.Hasher
	Marshalizer     marshal.Marshalizer
}

AccountsParserArgs holds all dependencies required by the accounts parser in order to create new instances

type DelegationDataHandler

type DelegationDataHandler interface {
	GetAddress() string
	AddressBytes() []byte
	GetValue() *big.Int
	IsInterfaceNil() bool
}

DelegationDataHandler represents the interface that describes the data held by a delegation address

type DelegationResult

type DelegationResult struct {
	NumTotalStaked    int
	NumTotalDelegated int
}

DelegationResult represents the DTO that contains the delegation results metrics

type DeployProcessor

type DeployProcessor interface {
	Deploy(sc InitialSmartContractHandler) ([][]byte, error)
	IsInterfaceNil() bool
}

DeployProcessor is able to deploy a smart contract

type IndexingData

type IndexingData struct {
	DelegationTxs      []data.TransactionHandler
	ScrsTxs            map[string]data.TransactionHandler
	StakingTxs         []data.TransactionHandler
	DeploySystemScTxs  []data.TransactionHandler
	DeployInitialScTxs []data.TransactionHandler
}

IndexingData specifies transactions sets that will be used for indexing

type InitialAccountHandler

type InitialAccountHandler interface {
	Clone() InitialAccountHandler
	GetAddress() string
	AddressBytes() []byte
	GetStakingValue() *big.Int
	GetBalanceValue() *big.Int
	GetSupply() *big.Int
	GetDelegationHandler() DelegationDataHandler
	IsInterfaceNil() bool
}

InitialAccountHandler represents the interface that describes the data held by an initial account

type InitialNodesHandler

type InitialNodesHandler interface {
	InitialNodesInfo() (map[uint32][]nodesCoordinator.GenesisNodeInfoHandler, map[uint32][]nodesCoordinator.GenesisNodeInfoHandler)
	MinNumberOfNodes() uint32
	MinNumberOfNodesWithHysteresis() uint32
	IsInterfaceNil() bool
}

InitialNodesHandler contains the initial nodes setup

type InitialSmartContractHandler

type InitialSmartContractHandler interface {
	GetOwner() string
	OwnerBytes() []byte
	GetFilename() string
	GetVmType() string
	GetInitParameters() string
	GetType() string
	VmTypeBytes() []byte
	AddAddressBytes(addressBytes []byte)
	AddressesBytes() [][]byte
	AddAddress(address string)
	Addresses() []string
	GetVersion() string
	IsInterfaceNil() bool
}

InitialSmartContractHandler represents the interface that describes the initial smart contract

type InitialSmartContractParser

type InitialSmartContractParser interface {
	InitialSmartContractsSplitOnOwnersShards(shardCoordinator sharding.Coordinator) (map[uint32][]InitialSmartContractHandler, error)
	GetDeployedSCAddresses(scType string) (map[string]struct{}, error)
	InitialSmartContracts() []InitialSmartContractHandler
	IsInterfaceNil() bool
}

InitialSmartContractParser contains the parsed genesis initial smart contracts json file and has some functionality regarding processed data

type NodesListSplitter

type NodesListSplitter interface {
	GetAllNodes() []nodesCoordinator.GenesisNodeInfoHandler
	GetDelegatedNodes(delegationScAddress []byte) []nodesCoordinator.GenesisNodeInfoHandler
	IsInterfaceNil() bool
}

NodesListSplitter is able to split de initial nodes based on some criteria

type TxExecutionProcessor

type TxExecutionProcessor interface {
	ExecuteTransaction(nonce uint64, sndAddr []byte, rcvAddress []byte, value *big.Int, data []byte) error
	GetAccount(address []byte) (state.UserAccountHandler, bool)
	GetNonce(senderBytes []byte) (uint64, error)
	AddBalance(senderBytes []byte, value *big.Int) error
	AddNonce(senderBytes []byte, nonce uint64) error
	GetExecutedTransactions() []data.TransactionHandler
	IsInterfaceNil() bool
}

TxExecutionProcessor represents a transaction builder and executor containing also related helper functions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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