Skip to content

Commit

Permalink
README: Added quickstart and proposal action descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Dec 6, 2023
1 parent 6030885 commit acc240c
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 13 deletions.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,51 @@ Testing tool that sits as a proxy between the beacon and validator clients in or
linkStyle 4,5 stroke-width:3px,fill:none,stroke:blue;
linkStyle 6,7 stroke-width:3px,fill:none,stroke:darkblue;
```
```

## Installation

```bash
git clone https://github.com/marioevz/blobber.git
cd blobber
go build -o blobber ./cmd
./blobber --help
```

## Use with Docker

```bash
docker run -it ethpandaops/blobber:latest --help
```

## Configuration

The blobber requires at least one consensus client in Beacon Node + Validator Client configuration, and the `--cl` flag must be provided to point to the Beacon Node REST API endpoint:

```bash
--cl http://beacon_node_1:4000/ --cl http://beacon_node_2:4000/ ...
```

The Beacon Node endpoint will be used to relay all Validator Client requests and intercept proposals, and also to obtain the client's ENR, which the blobber will use to connect to the client via devp2p.

The validator client must be then configured to connect to the blobber instead of the Beacon Node, starting at port 20,000 (by default) and increasing by 1 for each Beacon Node configured using the `--cl` flag.

## Proposal Actions

The blobber can be configured to perform actions on a block proposal, such as delaying blobs broadcasting, create equivocating blob sidecars, among other things.

At the moment, the blobber can be configured to do one proposal action with a certain frequency.

To configure the proposal action the flag `--proposal-action` is used:

```bash
--proposal-action '{"name": "blob_gossip_delay"}'
```

Each proposal action has configurable parameters which can be set with the same flag:

```bash
--proposal-action '{"name": "blob_gossip_delay", "delay_milliseconds": 1000}'
```

To see a list of available proposal actions see [here](./proposal_actions/README.md).
134 changes: 134 additions & 0 deletions proposal_actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# 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.
20 changes: 10 additions & 10 deletions proposal_actions/proposal_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func UnmarshallProposalAction(data []byte) (ProposalAction, error) {
action = &BlobGossipDelay{}
case "equivocating_blob_sidecars":
action = &EquivocatingBlobSidecars{}
case "equivocating_block_and_blobs":
action = &EquivocatingBlockAndBlobs{}
case "invalid_equivocating_block_and_blobs":
action = &InvalidEquivocatingBlockAndBlobs{}
case "equivocating_block_header_in_blobs":
action = &EquivocatingBlockHeaderInBlobs{}
case "invalid_equivocating_block":
Expand Down Expand Up @@ -280,19 +280,19 @@ func (s EquivocatingBlobSidecars) Execute(
return true, nil
}

type EquivocatingBlockAndBlobs struct {
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 (s EquivocatingBlockAndBlobs) Name() string {
func (s InvalidEquivocatingBlockAndBlobs) Name() string {
return "Equivocating Block and Blobs"
}

func (s EquivocatingBlockAndBlobs) Description() string {
func (s InvalidEquivocatingBlockAndBlobs) Description() string {
desc := dedent.Dedent(`
- Create an equivocating block by modifying the graffiti
- Sign both blocks
Expand All @@ -313,16 +313,16 @@ func (s EquivocatingBlockAndBlobs) Description() string {
return desc
}

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

func (s EquivocatingBlockAndBlobs) GetTestPeerCount() int {
func (s InvalidEquivocatingBlockAndBlobs) GetTestPeerCount() int {
// We are going to send two conflicting blocks and sets of blobs through two different test p2p connections
return 2
}

func (s EquivocatingBlockAndBlobs) Execute(
func (s InvalidEquivocatingBlockAndBlobs) Execute(
spec *beacon_common.Spec,
testPeers p2p.TestPeers,
beaconBlockContents *deneb.BlockContents,
Expand Down Expand Up @@ -368,7 +368,7 @@ func (s EquivocatingBlockHeaderInBlobs) Name() string {

func (s EquivocatingBlockHeaderInBlobs) Description() string {
desc := dedent.Dedent(`
- Create an equivocating block by modifying the graffiti
- Create an invalid equivocating block by modifying the graffiti
- Sign both blocks
- Generate the sidecars out of the equivocating signed block only`)
if s.BroadcastBlobsFirst {
Expand Down Expand Up @@ -436,7 +436,7 @@ func (s InvalidEquivocatingBlock) Name() string {

func (s InvalidEquivocatingBlock) Description() string {
desc := dedent.Dedent(`
- Create an equivocating block by modifying the graffiti
- 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
Expand Down
4 changes: 2 additions & 2 deletions proposal_actions/proposal_actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func TestProposalActionsJsonParsing(t *testing.T) {
}

jsonString = `{
"name": "equivocating_block_and_blobs",
"name": "invalid_equivocating_block_and_blobs",
"broadcast_blobs_first": true,
"alternate_recipients": true
}`
act, err = proposal_actions.UnmarshallProposalAction([]byte(jsonString))
if err != nil {
t.Fatalf("UnmarshallProposalAction() error = %v", err)
}
if actCast, ok := act.(*proposal_actions.EquivocatingBlockAndBlobs); !ok {
if actCast, ok := act.(*proposal_actions.InvalidEquivocatingBlockAndBlobs); !ok {
t.Fatalf("UnmarshallProposalAction() wrong type = %t", act)
} else {
if actCast.BroadcastBlobsFirst != true {
Expand Down

0 comments on commit acc240c

Please sign in to comment.