genesis

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const EpochStartMetaBlockIdentifier = "epochStartMetaBlock"

EpochStartMetaBlockIdentifier is the constant which defines the export/import identifier for epoch start metaBlock

View Source
const MiniBlocksIdentifier = "miniBlocks"

MiniBlocksIdentifier is the constant which defines the export/import identifier for miniBlocks

View Source
const TransactionsIdentifier = "transactions"

TransactionsIdentifier is the constant which defines the export/import identifier for transactions

View Source
const TrieIdentifier = "trie"

TrieIdentifier is the constant which defines the export/import identifier for tries

View Source
const UnFinishedMetaBlocksIdentifier = "unFinishedMetaBlocks"

UnFinishedMetaBlocksIdentifier is the constant which defines the export/import identifier for unFinished metaBlocks

View Source
const ValidatorsInfoIdentifier = "validatorsInfo"

ValidatorsInfoIdentifier is the constant which defines the export/import identifier for validators info

Variables

This section is empty.

Functions

func AddRootHashToIdentifier

func AddRootHashToIdentifier(identifier string, hash string) string

AddRootHashToIdentifier adds the roothash to the current identifier

func CreateAccountKey

func CreateAccountKey(accType Type, shId uint32, address []byte) string

CreateAccountKey creates a key for an account according to its type, shard ID and address

func CreateMiniBlockKey

func CreateMiniBlockKey(key string) string

CreateMiniBlockKey returns a miniblock key

func CreateRootHashKey

func CreateRootHashKey(trieIdentifier string) string

CreateRootHashKey creates a key of type roothash for a given trie identifier

func CreateTransactionKey

func CreateTransactionKey(key string, tx data.TransactionHandler) string

CreateTransactionKey create a transaction key according to its type

func CreateTrieIdentifier

func CreateTrieIdentifier(shID uint32, accountType Type) string

CreateTrieIdentifier creates a trie identifier according to trie type and shard id

func CreateValidatorInfoKey added in v1.4.0

func CreateValidatorInfoKey(key string) string

CreateValidatorInfoKey returns a validator info key

func CreateVersionKey

func CreateVersionKey(meta data.HeaderHandler, hash []byte) string

CreateVersionKey creates a version key from the given metaBlock

func NewEmptyAccount

func NewEmptyAccount(accType Type, address []byte) (vmcommon.AccountHandler, error)

NewEmptyAccount returns a new account according to the given type

func NewObject

func NewObject(objType Type) (interface{}, error)

NewObject creates an object according to the given type

func NewStateExporter

func NewStateExporter(args ArgsNewStateExporter) (*stateExport, error)

NewStateExporter exports all the data at a specific moment to a hardfork storer

func NewStateImport

func NewStateImport(args ArgsNewStateImport) (*stateImport, error)

NewStateImport creates an importer which reads all the files for a new start

Types

type ArgsNewStateExporter

type ArgsNewStateExporter struct {
	ShardCoordinator         sharding.Coordinator
	StateSyncer              update.StateSyncer
	Marshalizer              marshal.Marshalizer
	Hasher                   hashing.Hasher
	HardforkStorer           update.HardforkStorer
	ExportFolder             string
	AddressPubKeyConverter   core.PubkeyConverter
	ValidatorPubKeyConverter core.PubkeyConverter
	GenesisNodesSetupHandler update.GenesisNodesSetupHandler
}

ArgsNewStateExporter defines the arguments needed to create new state exporter

type ArgsNewStateImport

type ArgsNewStateImport struct {
	Hasher              hashing.Hasher
	Marshalizer         marshal.Marshalizer
	ShardID             uint32
	StorageConfig       config.StorageConfig
	TrieStorageManagers map[string]common.StorageManager
	HardforkStorer      update.HardforkStorer
}

ArgsNewStateImport is the arguments structure to create a new state importer

type Type

type Type uint8

Type identifies the type of the export / import

const (
	// Unknown is an export/import type which is not known by the system
	Unknown Type = iota
	// Transaction is the export/import type for pending transactions
	Transaction
	// SmartContractResult is the export/import type for pending smart contract results
	SmartContractResult
	// RewardTransaction is the export/import type for pending reward transaction
	RewardTransaction
	// MiniBlock is the export/import type for pending miniBlock
	MiniBlock
	// Header is the export/import type for pending headers
	Header
	// MetaHeader is the export/import type for pending meta headers
	MetaHeader
	// RootHash is the export/import type for byte array which has to be treated as rootHash
	RootHash
	// UserAccount is the export/import type for an account of type user account
	UserAccount
	// ValidatorAccount is the export/import type for peer account
	ValidatorAccount
	// DataTrie identifies the data trie kept under a specific account
	DataTrie
)

func GetKeyTypeAndHash

func GetKeyTypeAndHash(key string) (Type, []byte, error)

GetKeyTypeAndHash returns the type of the key by splitting it up and deciphering it

func GetTrieTypeAndShId

func GetTrieTypeAndShId(key string) (Type, uint32, error)

GetTrieTypeAndShId returns the type and shard Id for a given account according to the saved key

Jump to

Keyboard shortcuts

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