chaindb

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attestation

type Attestation struct {
	InclusionSlot      spec.Slot
	InclusionBlockRoot spec.Root
	InclusionIndex     uint64
	Slot               spec.Slot
	CommitteeIndex     spec.CommitteeIndex
	AggregationBits    []byte
	BeaconBlockRoot    spec.Root
	SourceEpoch        spec.Epoch
	SourceRoot         spec.Root
	TargetEpoch        spec.Epoch
	TargetRoot         spec.Root
}

Attestation holds information about an attestation included by a block.

type AttestationsProvider added in v0.1.4

type AttestationsProvider interface {
	// AttestationsForBlock fetches all attestations made for the given block.
	AttestationsForBlock(ctx context.Context, blockRoot spec.Root) ([]*Attestation, error)

	// AttestationsInBlock fetches all attestations contained in the given block.
	AttestationsInBlock(ctx context.Context, blockRoot spec.Root) ([]*Attestation, error)

	// AttestationsForSlotRange fetches all attestations made for the given slot range.
	AttestationsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*Attestation, error)
}

AttestationsProvider defines functions to access attestations.

type AttestationsSetter added in v0.1.4

type AttestationsSetter interface {
	// SetAttestation sets an attestation.
	SetAttestation(ctx context.Context, attestation *Attestation) error
}

AttestationsSetter defines functions to create and update attestations.

type AttesterDuty added in v0.1.3

type AttesterDuty struct {
	Slot           uint64
	Committee      uint64
	ValidatorIndex uint64
	// CommitteeIndex is the index of the validator in the committee.
	CommitteeIndex uint64
}

AttesterDuty holds information for attester duties.

type AttesterSlashing

type AttesterSlashing struct {
	InclusionSlot               spec.Slot
	InclusionBlockRoot          spec.Root
	InclusionIndex              uint64
	Attestation1Indices         []spec.ValidatorIndex
	Attestation1Slot            spec.Slot
	Attestation1CommitteeIndex  spec.CommitteeIndex
	Attestation1BeaconBlockRoot spec.Root
	Attestation1SourceEpoch     spec.Epoch
	Attestation1SourceRoot      spec.Root
	Attestation1TargetEpoch     spec.Epoch
	Attestation1TargetRoot      spec.Root
	Attestation1Signature       spec.BLSSignature
	Attestation2Indices         []spec.ValidatorIndex
	Attestation2Slot            spec.Slot
	Attestation2CommitteeIndex  spec.CommitteeIndex
	Attestation2BeaconBlockRoot spec.Root
	Attestation2SourceEpoch     spec.Epoch
	Attestation2SourceRoot      spec.Root
	Attestation2TargetEpoch     spec.Epoch
	Attestation2TargetRoot      spec.Root
	Attestation2Signature       spec.BLSSignature
}

AttesterSlashing holds information about an attester slashing included by a block.

type AttesterSlashingsSetter added in v0.1.4

type AttesterSlashingsSetter interface {
	// SetAttesterSlashing sets an attester slashing.
	SetAttesterSlashing(ctx context.Context, attesterSlashing *AttesterSlashing) error
}

AttesterSlashingsSetter defines functions to create and update attester slashings.

type BeaconCommittee

type BeaconCommittee struct {
	Slot      spec.Slot
	Index     spec.CommitteeIndex
	Committee []spec.ValidatorIndex
}

BeaconCommittee holds information for beacon committees.

type BeaconCommitteesProvider added in v0.1.4

type BeaconCommitteesProvider interface {
	// GetBeaconComitteeBySlotAndIndex fetches the beacon committee with the given slot and index.
	GetBeaconCommitteeBySlotAndIndex(ctx context.Context, slot spec.Slot, index spec.CommitteeIndex) (*BeaconCommittee, error)

	// GetAttesterDuties fetches the attester duties at the given slot range for the given validator indices.
	GetAttesterDuties(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot, validatorIndices []spec.ValidatorIndex) ([]*AttesterDuty, error)
}

BeaconCommitteesProvider defines functions to access beacon committee information.

type BeaconCommitteesSetter added in v0.1.4

type BeaconCommitteesSetter interface {
	// SetBeaconComittee sets a beacon committee.
	SetBeaconCommittee(ctx context.Context, beaconCommittee *BeaconCommittee) error
}

BeaconCommitteesSetter defines functions to create and update beacon committee information.

type Block

type Block struct {
	Slot             spec.Slot
	ProposerIndex    spec.ValidatorIndex
	Root             spec.Root
	Graffiti         []byte
	RANDAOReveal     spec.BLSSignature
	BodyRoot         spec.Root
	ParentRoot       spec.Root
	StateRoot        spec.Root
	ETH1BlockHash    []byte
	ETH1DepositCount uint64
	ETH1DepositRoot  spec.Root
}

Block holds information about a block.

type BlocksProvider added in v0.1.4

type BlocksProvider interface {
	// BlocksBySlot fetches all blocks with the given slot.
	BlocksBySlot(ctx context.Context, slot spec.Slot) ([]*Block, error)

	// BlockByRoot fetches the block with the given root.
	BlockByRoot(ctx context.Context, root spec.Root) (*Block, error)

	// BlocksByParentRoot fetches the blocks with the given parent root.
	BlocksByParentRoot(ctx context.Context, root spec.Root) ([]*Block, error)

	// EmptySlots fetches the slots in the given range without a block in the database.
	EmptySlots(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Slot, error)
}

BlocksProvider defines functions to access blocks.

type BlocksSetter added in v0.1.4

type BlocksSetter interface {
	// SetBlock sets a block.
	SetBlock(ctx context.Context, block *Block) error
}

BlocksSetter defines functions to create and update blocks.

type ProposerDutiesSetter added in v0.1.4

type ProposerDutiesSetter interface {
	// SetProposerDuty sets a proposer duty.
	SetProposerDuty(ctx context.Context, proposerDuty *ProposerDuty) error
}

ProposerDutiesSetter defines the functions to create and update proposer duties.

type ProposerDuty

type ProposerDuty struct {
	Slot           spec.Slot
	ValidatorIndex spec.ValidatorIndex
}

ProposerDuty holds information for proposer duties.

type ProposerSlashing

type ProposerSlashing struct {
	InclusionSlot        spec.Slot
	InclusionBlockRoot   spec.Root
	InclusionIndex       uint64
	Header1Slot          spec.Slot
	Header1ProposerIndex spec.ValidatorIndex
	Header1ParentRoot    spec.Root
	Header1StateRoot     spec.Root
	Header1BodyRoot      spec.Root
	Header1Signature     spec.BLSSignature
	Header2Slot          spec.Slot
	Header2ProposerIndex spec.ValidatorIndex
	Header2ParentRoot    spec.Root
	Header2StateRoot     spec.Root
	Header2BodyRoot      spec.Root
	Header2Signature     spec.BLSSignature
}

ProposerSlashing holds information about a proposer slashing included by a block.

type ProposerSlashingsProvider added in v0.1.4

type ProposerSlashingsProvider interface {
	// ProposerSlashingsForSlotRange fetches all proposer slashings made for the given slot range.
	ProposerSlashingsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*ProposerSlashing, error)
}

ProposerSlashingsProvider defines functions to access proposer slashings.

type ProposerSlashingsSetter added in v0.1.4

type ProposerSlashingsSetter interface {
	// SetProposerSlashing sets an proposer slashing.
	SetProposerSlashing(ctx context.Context, proposerSlashing *ProposerSlashing) error
}

ProposerSlashingsSetter defines functions to create and update proposer slashings.

type Service

type Service interface {
	// BeginTx begins a transaction.
	BeginTx(ctx context.Context) (context.Context, context.CancelFunc, error)

	// CommitTx commits a transaction.
	CommitTx(ctx context.Context) error

	// SetMetadata sets a metadata key to a JSON value.
	SetMetadata(ctx context.Context, key string, value []byte) error

	// Metadata obtains the JSON value from a metadata key.
	Metadata(ctx context.Context, key string) ([]byte, error)
}

Service defines a minimal chain database service.

type Validator

type Validator struct {
	PublicKey                  spec.BLSPubKey
	Index                      spec.ValidatorIndex
	EffectiveBalance           spec.Gwei
	Slashed                    bool
	ActivationEligibilityEpoch spec.Epoch
	ActivationEpoch            spec.Epoch
	ExitEpoch                  spec.Epoch
	WithdrawableEpoch          spec.Epoch
}

Validator holds information about a validator.

type ValidatorBalance

type ValidatorBalance struct {
	Index            spec.ValidatorIndex
	Epoch            spec.Epoch
	Balance          spec.Gwei
	EffectiveBalance spec.Gwei
}

ValidatorBalance holds information about a validator's balance at a given epoch.

type ValidatorsProvider added in v0.1.4

type ValidatorsProvider interface {
	// Validators fetches the validators.
	Validators(ctx context.Context) ([]*Validator, error)

	// ValidatorBalancesByValidatorsAndEpoch fetches the validator balances for the given validators and epoch.
	ValidatorBalancesByValidatorsAndEpoch(ctx context.Context, validators []*Validator, epoch spec.Epoch) (map[spec.ValidatorIndex]*ValidatorBalance, error)
}

ValidatorsProvider defines functions to access validator information.

type ValidatorsSetter added in v0.1.4

type ValidatorsSetter interface {
	// SetValidator sets a validator.
	SetValidator(ctx context.Context, validator *Validator) error

	// SetValidatorBalance sets a validator balance.
	SetValidatorBalance(ctx context.Context, validatorBalance *ValidatorBalance) error
}

ValidatorsSetter defines functions to create and update validator information.

type VoluntaryExit

type VoluntaryExit struct {
	InclusionSlot      spec.Slot
	InclusionBlockRoot spec.Root
	InclusionIndex     uint64
	ValidatorIndex     spec.ValidatorIndex
	Epoch              spec.Epoch
}

VoluntaryExit holds information about a voluntary exit included in a block.

type VoluntaryExitsSetter added in v0.1.4

type VoluntaryExitsSetter interface {
	// SetVoluntaryExit sets a voluntary exit.
	SetVoluntaryExit(ctx context.Context, voluntaryExit *VoluntaryExit) error
}

VoluntaryExitsSetter defines functions to create and update voluntary exits.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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