Documentation ¶
Index ¶
- Variables
- type BlsAggregateVerify
- type EpochProcessing
- type ForkChoice
- type ForkChoiceChecks
- type ForkChoicePayloadStatus
- type ForkChoiceStep
- func (f *ForkChoiceStep) GetAttestation() string
- func (f *ForkChoiceStep) GetAttesterSlashing() string
- func (f *ForkChoiceStep) GetBlock() string
- func (f *ForkChoiceStep) GetBlockHash() string
- func (f *ForkChoiceStep) GetChecks() *ForkChoiceChecks
- func (f *ForkChoiceStep) GetPayloadStatus() *ForkChoicePayloadStatus
- func (f *ForkChoiceStep) GetPowBlock() string
- func (f *ForkChoiceStep) GetTick() int
- func (f *ForkChoiceStep) GetValid() bool
- func (f *ForkChoiceStep) StepType() string
- type RewardsCore
- type Root
- type ShufflingCore
- type TransitionCore
Constants ¶
This section is empty.
Variables ¶
View Source
var FinalityFinality = spectest.HandlerFunc(func(t *testing.T, root fs.FS, c spectest.TestCase) (err error) { testState, err := spectest.ReadBeaconState(root, c.Version(), spectest.PreSsz) require.NoError(t, err) expectedState, err := spectest.ReadBeaconState(root, c.Version(), spectest.PostSsz) require.NoError(t, err) blocks, err := spectest.ReadBlocks(root, c.Version()) if err != nil { return err } startSlot := testState.Slot() for _, block := range blocks { if err := machine.TransitionState(c.Machine, testState, block); err != nil { require.NoError(t, fmt.Errorf("cannot transition state: %w. slot=%d. start_slot=%d", err, block.Block.Slot, startSlot)) } } expectedRoot, err := testState.HashSSZ() assert.NoError(t, err) haveRoot, err := expectedState.HashSSZ() assert.NoError(t, err) assert.EqualValues(t, haveRoot, expectedRoot, "state root") return nil })
View Source
var ForksFork = spectest.HandlerFunc(func(t *testing.T, root fs.FS, c spectest.TestCase) (err error) { preState, err := spectest.ReadBeaconState(root, c.Version()-1, spectest.PreSsz) require.NoError(t, err) postState, err := spectest.ReadBeaconState(root, c.Version(), spectest.PostSsz) expectedError := os.IsNotExist(err) if !expectedError { require.NoError(t, err) } switch preState.Version() { case clparams.Phase0Version: err = preState.UpgradeToAltair() case clparams.AltairVersion: err = preState.UpgradeToBellatrix() case clparams.BellatrixVersion: err = preState.UpgradeToCapella() case clparams.CapellaVersion: err = preState.UpgradeToDeneb() default: err = spectest.ErrHandlerNotImplemented(fmt.Sprintf("block state %v", preState.Version())) } if expectedError { assert.Error(t, err) } haveRoot, err := preState.HashSSZ() assert.NoError(t, err) expectedRoot, err := postState.HashSSZ() assert.NoError(t, err) assert.EqualValues(t, haveRoot, expectedRoot, "state root") return nil })
View Source
var SanityBlocks = spectest.HandlerFunc(func(t *testing.T, root fs.FS, c spectest.TestCase) (err error) { var meta struct { Description string `yaml:"description"` BlsSetting int `yaml:"bls_settings"` RevealDeadlinesSetting int `yaml:"reveal_deadlines_setting"` BlocksCount int `yaml:"blocks_count"` } err = spectest.ReadMeta(root, "meta.yaml", &meta) require.NoError(t, err) testState, err := spectest.ReadBeaconState(root, c.Version(), spectest.PreSsz) require.NoError(t, err) var expectedError bool expectedState, err := spectest.ReadBeaconState(root, c.Version(), spectest.PostSsz) if os.IsNotExist(err) { expectedError = true } else { require.NoError(t, err) } blocks, err := spectest.ReadBlocks(root, c.Version()) require.NoError(t, err) var block *cltypes.SignedBeaconBlock for _, block = range blocks { err = machine.TransitionState(c.Machine, testState, block) if err != nil { break } } if expectedError { require.Error(t, err) return nil } else { require.NoError(t, err) } finalRoot, err := expectedState.HashSSZ() require.NoError(t, err) haveRoot, err := testState.HashSSZ() require.NoError(t, err) assert.EqualValues(t, finalRoot, haveRoot) return nil })
View Source
var SanitySlots = spectest.HandlerFunc(func(t *testing.T, root fs.FS, c spectest.TestCase) (err error) { // TODO: this is unused, why? var slots int err = spectest.ReadMeta(root, "slots.yaml", &slots) require.NoError(t, err) testState, err := spectest.ReadBeaconState(root, c.Version(), spectest.PreSsz) require.NoError(t, err) expectedState, err := spectest.ReadBeaconState(root, c.Version(), spectest.PostSsz) require.NoError(t, err) err = c.Machine.ProcessSlots(testState, expectedState.Slot()) require.NoError(t, err) expectedRoot, err := expectedState.HashSSZ() require.NoError(t, err) haveRoot, err := testState.HashSSZ() require.NoError(t, err) assert.EqualValues(t, expectedRoot, haveRoot) return nil })
View Source
var TestFormats = spectest.Appendix{}
Functions ¶
This section is empty.
Types ¶
type BlsAggregateVerify ¶
type BlsAggregateVerify struct { }
type EpochProcessing ¶
type EpochProcessing struct {
Fn func(s abstract.BeaconState) error
}
func NewEpochProcessing ¶
func NewEpochProcessing(fn func(s abstract.BeaconState) error) *EpochProcessing
type ForkChoice ¶
type ForkChoice struct { }
func NewForkChoice ¶
func NewForkChoice(fn func(s abstract.BeaconState) error) *ForkChoice
type ForkChoiceChecks ¶
type ForkChoiceChecks struct { Head *struct { Slot *int `yaml:"slot,omitempty"` Root *common.Hash `yaml:"root,omitempty"` } `yaml:"head,omitempty"` Time *int `yaml:"time,omitempty"` GenesisTime *int `yaml:"genesis_time,omitempty"` JustifiedCheckpoint *struct { Epoch *int `yaml:"epoch,omitempty"` Root *common.Hash `yaml:"root,omitempty"` } `yaml:"justified_checkpoint,omitempty"` FinalizedCheckpoint *struct { Epoch *int `yaml:"epoch,omitempty"` Root *common.Hash `yaml:"root,omitempty"` } `yaml:"finalized_checkpoint,omitempty"` ProposerBoostRoot *common.Hash `yaml:"proposer_boost_root,omitempty"` }
type ForkChoicePayloadStatus ¶
type ForkChoiceStep ¶
type ForkChoiceStep struct { Tick *int `yaml:"tick,omitempty"` Valid *bool `yaml:"valid,omitempty"` Attestation *string `yaml:"attestation,omitempty"` Block *string `yaml:"block,omitempty"` PowBlock *string `yaml:"pow_block,omitempty"` AttesterSlashing *string `yaml:"attester_slashing,omitempty"` BlockHash *string `yaml:"block_hash,omitempty"` PayloadStatus *ForkChoicePayloadStatus `yaml:"payload_status,omitempty"` Checks *ForkChoiceChecks `yaml:"checks,omitempty"` }
func (*ForkChoiceStep) GetAttestation ¶
func (f *ForkChoiceStep) GetAttestation() string
func (*ForkChoiceStep) GetAttesterSlashing ¶
func (f *ForkChoiceStep) GetAttesterSlashing() string
func (*ForkChoiceStep) GetBlock ¶
func (f *ForkChoiceStep) GetBlock() string
func (*ForkChoiceStep) GetBlockHash ¶
func (f *ForkChoiceStep) GetBlockHash() string
func (*ForkChoiceStep) GetChecks ¶
func (f *ForkChoiceStep) GetChecks() *ForkChoiceChecks
func (*ForkChoiceStep) GetPayloadStatus ¶
func (f *ForkChoiceStep) GetPayloadStatus() *ForkChoicePayloadStatus
func (*ForkChoiceStep) GetPowBlock ¶
func (f *ForkChoiceStep) GetPowBlock() string
func (*ForkChoiceStep) GetTick ¶
func (f *ForkChoiceStep) GetTick() int
func (*ForkChoiceStep) GetValid ¶
func (f *ForkChoiceStep) GetValid() bool
func (*ForkChoiceStep) StepType ¶
func (f *ForkChoiceStep) StepType() string
type RewardsCore ¶
type RewardsCore struct { }
type ShufflingCore ¶
type ShufflingCore struct { }
Click to show internal directories.
Click to hide internal directories.