Skip to content

Commit

Permalink
refactor: Refactor event block creation in block.go
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Jan 20, 2025
1 parent b41e189 commit 0dbdf0e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ toolchain go1.22.1

replace github.com/prysmaticlabs/prysm/v5 => github.com/ethpandaops/prysm/v5 v5.1.4

replace github.com/attestantio/go-eth2-client => github.com/attestantio/go-eth2-client v0.23.1-0.20250114113159-1691823b93ca
replace github.com/attestantio/go-eth2-client => github.com/attestantio/go-eth2-client v0.23.1-0.20250116194652-2157b429c0f7

replace github.com/ethpandaops/beacon => github.com/ethpandaops/beacon v0.45.1-0.20250120040750-494d93735802
replace github.com/ethpandaops/beacon => github.com/ethpandaops/beacon v0.45.1-0.20250120085245-c11c1ec64ea7

require (
github.com/IBM/sarama v1.43.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
github.com/attestantio/go-eth2-client v0.23.1-0.20250114113159-1691823b93ca h1:njmfFXpK2EpzsjqSKpT8FbZ0OMAs4Q0xe0IpeGV8cCM=
github.com/attestantio/go-eth2-client v0.23.1-0.20250114113159-1691823b93ca/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A=
github.com/attestantio/go-eth2-client v0.23.1-0.20250116194652-2157b429c0f7 h1:k+x71pLHEEPNVHS+hMlC+G5hjMT0ynAZZygOSkPayrI=
github.com/attestantio/go-eth2-client v0.23.1-0.20250116194652-2157b429c0f7/go.mod h1:vy5jU/uDZ2+RcVzq5BfnG+bQ3/6uu9DGwCrGsPtjJ1A=
github.com/avast/retry-go/v4 v4.5.1 h1:AxIx0HGi4VZ3I02jr78j5lZ3M6x1E0Ivxa6b0pUUh7o=
github.com/avast/retry-go/v4 v4.5.1/go.mod h1:/sipNsvNB3RRuT5iNcb6h73nw3IBmXJ/H3XrCQYSOpc=
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
Expand Down Expand Up @@ -248,8 +248,8 @@ github.com/ethereum/go-ethereum v1.14.10 h1:kC24WjYeRjDy86LVo6MfF5Xs7nnUu+XG4Aja
github.com/ethereum/go-ethereum v1.14.10/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E=
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A=
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
github.com/ethpandaops/beacon v0.45.1-0.20250120040750-494d93735802 h1:EuV5Xa6YvXFmFRkD7NWTYoBdGl7tiz50xHm0DwBxTY8=
github.com/ethpandaops/beacon v0.45.1-0.20250120040750-494d93735802/go.mod h1:dxl4lqG3HG7d3h4FQl1093SL6I6/2cJd4O24rCuFccE=
github.com/ethpandaops/beacon v0.45.1-0.20250120085245-c11c1ec64ea7 h1:iJ+ZhNBgAMUCX/LrfQAs8Aw3Ua4jaDbdOkLGw/aPuFw=
github.com/ethpandaops/beacon v0.45.1-0.20250120085245-c11c1ec64ea7/go.mod h1:QyqD0nTD9WYdwdekwxqF2xCoNqGXQ0DAj5ZFP2OUoFY=
github.com/ethpandaops/ethcore v0.0.0-20240422023000-2a5727b18756 h1:8JWjrRfP14m0oxOk03m11n/xgdY5ceyUf/ZxYdOs5gE=
github.com/ethpandaops/ethcore v0.0.0-20240422023000-2a5727b18756/go.mod h1:ZvKqL6CKxiraefdXPHeJurV2pDD/f2HF2uklDVdrry8=
github.com/ethpandaops/ethwallclock v0.3.0 h1:xF5fwtBf+bHFHZKBnwiPFEuelW3sMM7SD3ZNFq1lJY4=
Expand Down
9 changes: 7 additions & 2 deletions pkg/proto/eth/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func NewEventBlockFromElectra(block *electra.BeaconBlock, signature *phase0.BLSS
kzgCommitments = append(kzgCommitments, commitment.String())
}

return &v2.EventBlockV2{
event := &v2.EventBlockV2{
Version: v2.BlockVersion_ELECTRA,
Message: &v2.EventBlockV2_ElectraBlock{
ElectraBlock: &v2.BeaconBlockElectra{
Expand Down Expand Up @@ -376,6 +376,11 @@ func NewEventBlockFromElectra(block *electra.BeaconBlock, signature *phase0.BLSS
},
},
},
Signature: signature.String(),
}

if signature != nil && !signature.IsZero() {
event.Signature = signature.String()
}

return event
}

0 comments on commit 0dbdf0e

Please sign in to comment.