From acc240c680e2a10f6e6b9302d10571414e6133c6 Mon Sep 17 00:00:00 2001 From: Mario Vega Date: Wed, 6 Dec 2023 17:30:55 +0000 Subject: [PATCH] README: Added quickstart and proposal action descriptions --- README.md | 49 +++++++- proposal_actions/README.md | 134 ++++++++++++++++++++++ proposal_actions/proposal_actions.go | 20 ++-- proposal_actions/proposal_actions_test.go | 4 +- 4 files changed, 194 insertions(+), 13 deletions(-) create mode 100644 proposal_actions/README.md diff --git a/README.md b/README.md index e3bd201..e6a74a2 100644 --- a/README.md +++ b/README.md @@ -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; -``` \ No newline at end of file +``` + +## 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). \ No newline at end of file diff --git a/proposal_actions/README.md b/proposal_actions/README.md new file mode 100644 index 0000000..b933ddf --- /dev/null +++ b/proposal_actions/README.md @@ -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. \ No newline at end of file diff --git a/proposal_actions/proposal_actions.go b/proposal_actions/proposal_actions.go index b9ff7f3..ef79d18 100644 --- a/proposal_actions/proposal_actions.go +++ b/proposal_actions/proposal_actions.go @@ -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": @@ -280,7 +280,7 @@ 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"` @@ -288,11 +288,11 @@ type EquivocatingBlockAndBlobs struct { 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 @@ -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, @@ -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 { @@ -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 diff --git a/proposal_actions/proposal_actions_test.go b/proposal_actions/proposal_actions_test.go index fd3fd7f..fac1f43 100644 --- a/proposal_actions/proposal_actions_test.go +++ b/proposal_actions/proposal_actions_test.go @@ -42,7 +42,7 @@ func TestProposalActionsJsonParsing(t *testing.T) { } jsonString = `{ - "name": "equivocating_block_and_blobs", + "name": "invalid_equivocating_block_and_blobs", "broadcast_blobs_first": true, "alternate_recipients": true }` @@ -50,7 +50,7 @@ func TestProposalActionsJsonParsing(t *testing.T) { 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 {