admin

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handlers

type Handlers struct {
	sync.RWMutex

	ReceiveLock chan interfaces.Lockable
	// contains filtered or unexported fields
}

Handlers Is a private bus for internal service use. At this time the only reason to use this bus is to enable blockchain events to be fed into the system and for accusations to be fed out of the system and into the Ethereum blockchain.

func (*Handlers) AddPrivateKey

func (ah *Handlers) AddPrivateKey(pk []byte, curveSpec constants.CurveSpec) error

AddPrivateKey stores a private key from an EthDKG run into an encrypted keystore in the DB.

func (*Handlers) AddSnapshot

func (ah *Handlers) AddSnapshot(bh *objs.BlockHeader, safeToProceedConsensus bool) error

AddSnapshot stores a snapshot to the database.

func (*Handlers) AddValidatorSet

func (ah *Handlers) AddValidatorSet(v *objs.ValidatorSet) error

AddValidatorSet adds a validator set to the db This function also creates the first block and initializes the genesis state when the first validator set is written.

func (*Handlers) AddValidatorSetEdgecase

func (ah *Handlers) AddValidatorSetEdgecase(txn *badger.Txn, v *objs.ValidatorSet) error

AddValidatorSetEdgecase adds a validator set to the db if we have the expected block at the height 'v.NotBefore-1' (e.g syncing from the ethereum data). Otherwise, it will mark the change to happen in the future once we have the required block.

func (*Handlers) Close

func (ah *Handlers) Close()

Close shuts down all workers.

func (*Handlers) GetKey

func (ah *Handlers) GetKey(kid []byte) ([]byte, error)

GetKey allows the admin handler to act as a key resolver for decrypting stored private keys.

func (*Handlers) GetPrivK

func (ah *Handlers) GetPrivK(name []byte) ([]byte, error)

GetPrivK returns an decrypted private key from an EthDKG run to the caller.

func (*Handlers) Init

func (ah *Handlers) Init(chainID uint32, database *db.Database, secret []byte, appHandler interfaces.Application, ethPubk []byte, storage dynamics.StorageGetter)

Init creates all fields and binds external services.

func (*Handlers) InitializationMonitor

func (ah *Handlers) InitializationMonitor(closeChan <-chan struct{})

InitializationMonitor polls the database for the existence of a snapshot It sets IsInitialized when one is found and returns.

func (*Handlers) IsInitialized

func (ah *Handlers) IsInitialized() bool

IsInitialized returns if the database has been initialized yet.

func (*Handlers) IsSynchronized

func (ah *Handlers) IsSynchronized() bool

IsSynchronized returns if the ethereum BC has been/is synchronized.

func (*Handlers) RegisterSnapshotCallback

func (ah *Handlers) RegisterSnapshotCallback(fn func(bh *objs.BlockHeader, numOfValidators, validatorIndex int) error)

RegisterSnapshotCallback allows a callback to be registered that will be called on snapshot blocks being added to the local db.

func (*Handlers) SetSynchronized

func (ah *Handlers) SetSynchronized(v bool)

SetSynchronized allows the BC monitor to set the sync state for ethereum.

func (*Handlers) UpdateDynamicStorage

func (ah *Handlers) UpdateDynamicStorage(epoch uint32, rawDynamics []byte) error

UpdateDynamicStorage updates dynamic storage values.

Jump to

Keyboard shortcuts

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