proposal_actions

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 15 Imported by: 1

README

Blobber Proposal Actions

Default

JSON Name

default

Description
  • Sign the block
  • Generate the blob sidecars using signed header

Depending on broadcast_blobs_first it can:

  • Broadcast the blob sidecars
  • Broadcast the block

Or:

  • Broadcast the block
  • Broadcast the blob sidecars
Parameters
  • broadcast_blobs_first [bool]: Whether the blobs should be gossiped before the block or not

Blob Gossip Delay

JSON Name

blob_gossip_delay

Description
  • Sign the block
  • Generate the blob sidecars using signed header
  • Broadcast the block
  • Insert a delay of delay_milliseconds milliseconds
  • Broadcast the blob sidecars
Parameters
  • delay_milliseconds [int]: Amount of milliseconds to delay the blob gossiping

Equivocating Blob Sidecars

JSON Name

equivocating_blob_sidecars

Description
  • Create an invalid equivocating block by modifying the graffiti
  • Sign both blocks
  • Generate blob sidecar bundles out of both signed blocks

Depending on broadcast_blobs_first it can:

  • Broadcast both blob sidecar bundles to different peers
  • Broadcast the original signed block only

Or:

  • Broadcast the original signed block only
  • Broadcast both blob sidecar bundles to different peers
Parameters
  • broadcast_blobs_first [bool]: Whether the blobs should be gossiped before the block or not

Invalid Equivocating Block And Blobs

JSON Name

invalid_equivocating_block_and_blobs

Description
  • Create an invalid equivocating block by modifying the graffiti
  • Sign both blocks
  • Generate blob sidecars for both blocks

Depending on broadcast_blobs_first it can:

  • Broadcast the blob sidecars for both blocks to different peers
  • Broadcast the signed blocks to different peers

Or:

  • Broadcast the signed blocks to different peers
  • Broadcast the blob sidecars for both blocks to different peers
Parameters
  • broadcast_blobs_first [bool]: Whether the blobs should be gossiped before the block or not
  • alternate_recipients [bool]: Alternate the recipients of the blocks and blobs every time the action is executed

Equivocating Block Header In Blobs

JSON Name

equivocating_block_header_in_blobs

Description
  • Create an invalid equivocating block by modifying the graffiti
  • Sign both blocks
  • Generate the sidecars out of the equivocating signed block only

Depending on broadcast_blobs_first it can:

  • Broadcast the blob sidecars with the equivocating block header
  • Broadcast the original signed block only

Or:

  • Broadcast the original signed block only
  • Broadcast the blob sidecars with the equivocating block header
Parameters
  • broadcast_blobs_first [bool]: Whether the blobs should be gossiped before the block or not

Invalid Equivocating Block

JSON Name

invalid_equivocating_block

Description
  • Create an invalid equivocating block by modifying the graffiti
  • Sign both blocks
  • Generate the sidecars out of the correct block only
  • Broadcast the blob sidecars
  • Broadcast the equivocating signed block and the correct signed block to different peers
Parameters

None.

Documentation

Index

Constants

View Source
const MAX_BLOBS_PER_BLOCK = 6

Variables

This section is empty.

Functions

func CopyBlobSidecars

func CopyBlobSidecars(blobs []*deneb.BlobSidecar) ([]*deneb.BlobSidecar, error)

func CopyBlobs

func CopyBlobs(blobs []deneb.Blob) ([]deneb.Blob, error)

func CopyBlockContents

func CopyBlockContents(bc *deneb.BlockContents) (*deneb.BlockContents, error)

func MultiPeerBlobBroadcast

func MultiPeerBlobBroadcast(spec *common.Spec, peers p2p.TestPeers, blobsLists ...[]*deneb.BlobSidecar) error

func RootToText

func RootToText(root tree.Root) (string, error)

func SignBlockContents

func SignBlockContents(spec *common.Spec, blockContents *deneb.BlockContents, beaconBlockDomain common.BLSDomain, validatorKey *keys.ValidatorKey) (*deneb.SignedBlockContents, error)

func TextToRoot

func TextToRoot(s string) (root tree.Root, err error)

func VerifySignature

func VerifySignature(domain common.BLSDomain, root common.Root, pubKey *blsu.Pubkey, signature common.BLSSignature) (bool, error)

Types

type BlobGossipDelay

type BlobGossipDelay struct {
	Default
	DelayMilliseconds int `json:"delay_milliseconds"`
}

func (BlobGossipDelay) Description

func (s BlobGossipDelay) Description() string

func (BlobGossipDelay) Execute

func (s BlobGossipDelay) Execute(
	spec *beacon_common.Spec,
	testPeers p2p.TestPeers,
	beaconBlockContents *deneb.BlockContents,
	beaconBlockDomain beacon_common.BLSDomain,
	validatorKey *keys.ValidatorKey,
	includeBlobRecord *common.BlobRecord,
	rejectBlobRecord *common.BlobRecord,
) (bool, error)

func (BlobGossipDelay) Fields

func (s BlobGossipDelay) Fields() map[string]interface{}

func (BlobGossipDelay) Name

func (s BlobGossipDelay) Name() string

func (BlobGossipDelay) SlotMiss

func (s BlobGossipDelay) SlotMiss(spec *beacon_common.Spec) bool

type BlockModifier

type BlockModifier interface {
	ModifyBlock(spec *common.Spec, block interface{}) error
}

type BundleBroadcaster

type BundleBroadcaster struct {
	Spec  *common.Spec
	Peers p2p.TestPeers
	// Delay in milliseconds between broadcast of blocks and blob sidecars
	DelayMilliseconds int
	// Delay in milliseconds between broadcast to different peers
	PeerBroadcastDelayMilliseconds int
	// If true, broadcast blobs first, then blocks
	BlobsFirst bool
}

func (BundleBroadcaster) Broadcast

func (b BundleBroadcaster) Broadcast(bundles ...*SignedBlockSidecarsBundle) error

type Default

type Default struct {
	BroadcastBlobsFirst bool `json:"broadcast_blobs_first"`
}

func (Default) Description

func (s Default) Description() string

func (Default) Execute

func (s Default) Execute(
	spec *beacon_common.Spec,
	testPeers p2p.TestPeers,
	beaconBlockContents *deneb.BlockContents,
	beaconBlockDomain beacon_common.BLSDomain,
	validatorKey *keys.ValidatorKey,
	includeBlobRecord *common.BlobRecord,
	rejectBlobRecord *common.BlobRecord,
) (bool, error)

func (Default) Fields

func (s Default) Fields() map[string]interface{}

func (Default) GetTestPeerCount

func (s Default) GetTestPeerCount() int

func (Default) Name

func (s Default) Name() string

func (Default) SlotMiss

func (s Default) SlotMiss(_ *beacon_common.Spec) bool

type EquivocatingBlobSidecars

type EquivocatingBlobSidecars struct {
	Default
	BroadcastBlobsFirst bool `json:"broadcast_blobs_first"`
}

func (EquivocatingBlobSidecars) Description

func (s EquivocatingBlobSidecars) Description() string

func (EquivocatingBlobSidecars) Execute

func (s EquivocatingBlobSidecars) Execute(
	spec *beacon_common.Spec,
	testPeers p2p.TestPeers,
	beaconBlockContents *deneb.BlockContents,
	beaconBlockDomain beacon_common.BLSDomain,
	validatorKey *keys.ValidatorKey,
	includeBlobRecord *common.BlobRecord,
	rejectBlobRecord *common.BlobRecord,
) (bool, error)

func (EquivocatingBlobSidecars) Fields

func (s EquivocatingBlobSidecars) Fields() map[string]interface{}

func (EquivocatingBlobSidecars) GetTestPeerCount

func (s EquivocatingBlobSidecars) GetTestPeerCount() int

func (EquivocatingBlobSidecars) Name

type EquivocatingBlockHeaderInBlobs

type EquivocatingBlockHeaderInBlobs struct {
	Default
	BroadcastBlobsFirst bool `json:"broadcast_blobs_first"`
}

func (EquivocatingBlockHeaderInBlobs) Description

func (s EquivocatingBlockHeaderInBlobs) Description() string

func (EquivocatingBlockHeaderInBlobs) Execute

func (s EquivocatingBlockHeaderInBlobs) Execute(
	spec *beacon_common.Spec,
	testPeers p2p.TestPeers,
	beaconBlockContents *deneb.BlockContents,
	beaconBlockDomain beacon_common.BLSDomain,
	validatorKey *keys.ValidatorKey,
	includeBlobRecord *common.BlobRecord,
	rejectBlobRecord *common.BlobRecord,
) (bool, error)

func (EquivocatingBlockHeaderInBlobs) Fields

func (s EquivocatingBlockHeaderInBlobs) Fields() map[string]interface{}

func (EquivocatingBlockHeaderInBlobs) Name

type GraffitiModifier

type GraffitiModifier struct {
	NewGraffiti string
	Append      bool
}

func (*GraffitiModifier) ModifyBlock

func (gm *GraffitiModifier) ModifyBlock(spec *common.Spec, block interface{}) error

type InvalidBlobSidecar

type InvalidBlobSidecar struct {
	Default
}

type InvalidEquivocatingBlock

type InvalidEquivocatingBlock struct {
	Default
}

func (InvalidEquivocatingBlock) Description

func (s InvalidEquivocatingBlock) Description() string

func (InvalidEquivocatingBlock) Execute

func (s InvalidEquivocatingBlock) Execute(
	spec *beacon_common.Spec,
	testPeers p2p.TestPeers,
	beaconBlockContents *deneb.BlockContents,
	beaconBlockDomain beacon_common.BLSDomain,
	validatorKey *keys.ValidatorKey,
	includeBlobRecord *common.BlobRecord,
	rejectBlobRecord *common.BlobRecord,
) (bool, error)

func (InvalidEquivocatingBlock) Fields

func (s InvalidEquivocatingBlock) Fields() map[string]interface{}

func (InvalidEquivocatingBlock) GetTestPeerCount

func (s InvalidEquivocatingBlock) GetTestPeerCount() int

func (InvalidEquivocatingBlock) Name

type InvalidEquivocatingBlockAndBlobs

type InvalidEquivocatingBlockAndBlobs struct {
	Default
	BroadcastBlobsFirst bool `json:"broadcast_blobs_first"`
	// TODO: ModifyBlobs         bool `json:"modify_blobs"`
	// TODO: ModifyKZGProofs     bool `json:"modify_kzg_proofs"`
	AlternateRecipients bool `json:"alternate_recipients"`
}

func (InvalidEquivocatingBlockAndBlobs) Description

func (s InvalidEquivocatingBlockAndBlobs) Description() string

func (InvalidEquivocatingBlockAndBlobs) Execute

func (s InvalidEquivocatingBlockAndBlobs) Execute(
	spec *beacon_common.Spec,
	testPeers p2p.TestPeers,
	beaconBlockContents *deneb.BlockContents,
	beaconBlockDomain beacon_common.BLSDomain,
	validatorKey *keys.ValidatorKey,
	includeBlobRecord *common.BlobRecord,
	rejectBlobRecord *common.BlobRecord,
) (bool, error)

func (InvalidEquivocatingBlockAndBlobs) Fields

func (s InvalidEquivocatingBlockAndBlobs) Fields() map[string]interface{}

func (InvalidEquivocatingBlockAndBlobs) GetTestPeerCount

func (s InvalidEquivocatingBlockAndBlobs) GetTestPeerCount() int

func (InvalidEquivocatingBlockAndBlobs) Name

type ProposalAction

type ProposalAction interface {
	Name() string
	Description() string
	SlotMiss(spec *beacon_common.Spec) bool
	Fields() map[string]interface{}
	GetTestPeerCount() int
	Execute(
		spec *beacon_common.Spec,
		testPeers p2p.TestPeers,
		beaconBlockContents *deneb.BlockContents,
		beaconBlockDomain beacon_common.BLSDomain,
		validatorKey *keys.ValidatorKey,
		includeBlobRecord *common.BlobRecord,
		rejectBlobRecord *common.BlobRecord,
	) (bool, error)
}

func UnmarshallProposalAction

func UnmarshallProposalAction(data []byte) (ProposalAction, error)

type SignedBlockSidecarsBundle

type SignedBlockSidecarsBundle struct {
	SignedBlock  *deneb.SignedBeaconBlock
	BlobSidecars []*deneb.BlobSidecar
}

func CreateSignEquivocatingBlock

func CreateSignEquivocatingBlock(
	spec *common.Spec,
	beaconBlockContents *deneb.BlockContents,
	beaconBlockDomain common.BLSDomain,
	validatorKey *keys.ValidatorKey,
) ([]*SignedBlockSidecarsBundle, error)

func CreatedSignedBlockSidecarsBundle

func CreatedSignedBlockSidecarsBundle(
	spec *common.Spec,
	beaconBlockContents *deneb.BlockContents,
	beaconBlockDomain common.BLSDomain,
	validatorKey *keys.ValidatorKey,
) (*SignedBlockSidecarsBundle, error)

Jump to

Keyboard shortcuts

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