Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(all): Cumulative branch - attempt 2 #2127

Open
wants to merge 146 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 135 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
7b1539d
fixed ExecutionPayload json marshalling
abi87 Oct 4, 2024
af8871c
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Oct 7, 2024
b463d5b
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Oct 10, 2024
844694e
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Oct 13, 2024
af9bab6
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Oct 15, 2024
9829574
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Oct 16, 2024
2b1eb76
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Oct 17, 2024
3bf2b3e
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Oct 17, 2024
ed5c3ae
hardened verifyChainIDAndConnection
abi87 Oct 22, 2024
8715a04
guard SendForceHeadFCU with pb.Enabled
abi87 Oct 22, 2024
62cbd7b
added ValidateValidatorStatus
abi87 Oct 22, 2024
b383b0a
hardened node-api default address
abi87 Oct 22, 2024
9ced281
hardened node-api custom validator validation
abi87 Oct 22, 2024
825d4d3
Merge branch 'main' into harden-verifyChainIDAndConnection
nidhi-singh02 Oct 22, 2024
15e37d0
Merge branch 'main' into check-PayloadBuilder-enabled
nidhi-singh02 Oct 22, 2024
b1e1edb
Merge branch 'main' into hardened-node-api-custom-validator
abi87 Oct 22, 2024
7b3b4b3
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Oct 22, 2024
ffec0b3
Merge branch 'main' into node-api-default-address
nidhi-singh02 Oct 23, 2024
91ab836
updated node-api address for kurtosis - tests fiz
nidhi-singh02 Oct 23, 2024
eea8ead
nits
abi87 Oct 23, 2024
49538dc
wip: extended sdk.Context use to middleware
abi87 Oct 23, 2024
b303196
dropped unnecessary types and file
abi87 Oct 23, 2024
847cd52
some more types cleanup
abi87 Oct 23, 2024
020cb11
some more types cleanup
abi87 Oct 23, 2024
92bbfae
added type for BeaconBlock with relevant consensus data
abi87 Oct 23, 2024
69efa86
nits
abi87 Oct 23, 2024
8b87b65
wip: adding consensus data to blocks to be verified
abi87 Oct 23, 2024
be54ae7
wip: added consensus block to blockchain service
abi87 Oct 23, 2024
196f1ec
wip: used consensus block type in blockchain service
abi87 Oct 23, 2024
55126cb
wip: fixed dispatching of consensus blocks
abi87 Oct 23, 2024
ce0d420
wip: rebased next payload timestamp on top of consensus block time
abi87 Oct 23, 2024
49b31a8
wip: rebased next payload timestamp from finalized block on top of co…
abi87 Oct 23, 2024
7975424
nit
abi87 Oct 23, 2024
70bba14
wip: fixed dispatching of finalized beacon blocks
abi87 Oct 23, 2024
0365941
wip: rebased next payload timestamp for building blocks on top of con…
abi87 Oct 23, 2024
da314f1
nits
abi87 Oct 23, 2024
36041e8
fixed consensus time setting
abi87 Oct 23, 2024
13a93ea
improved SlotData encapsulation
abi87 Oct 24, 2024
f13cdf7
Merge branch 'main' into consensus_decorated_events
abi87 Oct 24, 2024
0c6e82a
nit
abi87 Oct 24, 2024
20c881e
dropped minor code duplication
abi87 Oct 24, 2024
b053357
Merge branch 'main' into hardened-node-api-custom-validator
nidhi-singh02 Oct 24, 2024
6b106b8
fix(blockchain): Further timestamp simplification (#2097)
abi87 Oct 24, 2024
e447c20
fix(state-transition): Validate execution payload timestamp (#2096)
abi87 Oct 24, 2024
cbc89a4
Merge branch 'main' into consensus_decorated_events
abi87 Oct 25, 2024
699df26
fix(consensus, beacon): let consensus tell SuggestedNextPayloadTimest…
abi87 Oct 25, 2024
6c256d4
fixed comment
abi87 Oct 25, 2024
f386d51
nit to appease rabbit + revert faulty change
abi87 Oct 25, 2024
b2bf298
wip: added proposerAddress to consensus block
abi87 Oct 25, 2024
08f00c2
wip: added proposerAddress to slot data
abi87 Oct 25, 2024
3ee634d
nit
abi87 Oct 25, 2024
e66ef6c
hardened check
abi87 Oct 25, 2024
d4779f9
wip: adding validation
abi87 Oct 25, 2024
b2aa1af
Merge branch 'consensus_decorated_events' into harden-proposer-valida…
abi87 Oct 25, 2024
745c396
coherent use of effective balance increment
abi87 Oct 26, 2024
5835638
hardened convert amount to avoid truncation
abi87 Oct 26, 2024
d799879
updated mimetype dep
abi87 Oct 26, 2024
36286bb
Merge branch 'main' into harden-verifyChainIDAndConnection
abi87 Oct 27, 2024
e48be9c
Merge branch 'main' into check-PayloadBuilder-enabled
abi87 Oct 27, 2024
30eb657
Merge branch 'main' into node-api-ValidateValidatorStatus
abi87 Oct 27, 2024
b4a1077
skip zero amount withdrawals to reduce number of withdrawals processed
abi87 Oct 28, 2024
783f59e
increase balance when validator balance is changed
abi87 Oct 28, 2024
c5d6f0b
improved block processor encapsulation
abi87 Oct 29, 2024
b7db920
some more encapsulation
abi87 Oct 29, 2024
f4a7d79
wip: adding UTs to state transition package
abi87 Oct 29, 2024
0f46172
wip: completed simple UT for state transition package
abi87 Oct 29, 2024
22c7717
wip: minimal execution engine stub
abi87 Oct 29, 2024
05cba80
extended asserts
abi87 Oct 29, 2024
443ac1b
added test case
abi87 Oct 29, 2024
10efd5e
nits
abi87 Oct 29, 2024
099716d
tests for helpers in state transition using mock
nidhi-singh02 Oct 30, 2024
151a533
Revert "tests for helpers in state transition using mock"
nidhi-singh02 Oct 30, 2024
9818c7e
tests with only mock for execution engine
nidhi-singh02 Oct 30, 2024
160cc88
removed test for VerifyAndNotifyNewPayload
nidhi-singh02 Oct 30, 2024
4a9fe1c
nit
abi87 Oct 31, 2024
e048be4
improved unit tests asserts
abi87 Oct 31, 2024
a960d06
Merge branch 'state-transition-add-UTs' into fix-update-balance-upon-…
abi87 Oct 31, 2024
8bf34db
appease linter
abi87 Oct 31, 2024
3985ad2
Merge branch 'state-transition-add-UTs' into fix-update-balance-upon-…
abi87 Oct 31, 2024
d90a95a
fix(state-transition): fix deposit index upon genesis processing (#2116)
abi87 Oct 31, 2024
e3ec723
Merge branch 'main' into coherent-effectiveBalanceIncrement
itsdevbear Oct 31, 2024
e17d29c
fixed bad merge
abi87 Oct 31, 2024
1bce2ee
Merge branch 'state-transition-add-UTs' into fix-update-balance-upon-…
abi87 Oct 31, 2024
90e9cd6
fixed balance + added UTs to confirm
abi87 Oct 31, 2024
0c0b3d5
Merge branch 'main' into consensus_decorated_events
abi87 Oct 31, 2024
4964f98
add UTs for validators update
abi87 Oct 31, 2024
14ea836
appease nilaway
abi87 Oct 31, 2024
61e3cfe
Merge branch 'consensus_decorated_events' into harden-proposer-valida…
abi87 Oct 31, 2024
11df8e5
fixed comment
abi87 Oct 31, 2024
8dfe59d
Merge branch 'main' into fix-maximum-number-withdrawals
abi87 Nov 1, 2024
daa9262
Merge branch 'state-transition-add-UTs' into fix-maximum-number-withd…
abi87 Nov 1, 2024
92d494f
added UTs to show no withdrawals are made when unnecessary
abi87 Nov 1, 2024
6286b20
Merge branch 'main' into state-transition-add-UTs
abi87 Nov 1, 2024
41a7657
Merge branch 'state-transition-add-UTs' into fix-update-balance-upon-…
abi87 Nov 1, 2024
a1a3def
Merge branch 'state-transition-add-UTs' into fix-maximum-number-withd…
abi87 Nov 1, 2024
b395ac2
added validator set cap size to chain specs
abi87 Nov 1, 2024
63e4db0
Merge branch 'fix-maximum-number-withdrawals' into validator-size-cap
abi87 Nov 1, 2024
36fe774
enforce validator set size cap on genesis
abi87 Nov 1, 2024
e64bc74
appease gosec
abi87 Nov 1, 2024
c6c68c3
mark extra validators as withdrawable
abi87 Nov 1, 2024
37542a0
nit
abi87 Nov 1, 2024
ea69a35
avoid double validators set cap checks on genesis
abi87 Nov 1, 2024
af43b93
add UT showing extra validator is added ready for withdrawal
abi87 Nov 1, 2024
a728bcb
extend UT to show extra validator deposit is withdrawn
abi87 Nov 1, 2024
97fba5c
fix withdrawal index update
abi87 Nov 1, 2024
826351d
Merge branch 'fix-maximum-number-withdrawals' into validator-size-cap
abi87 Nov 1, 2024
af8c5e0
fix(build): erigon repo
gummybera Nov 1, 2024
023ebfd
fix(build): bump erigon to recent version
gummybera Nov 1, 2024
d66b298
nits from code review
abi87 Nov 1, 2024
43b1eb4
Merge branch 'fix-erigon' into validator-size-cap
abi87 Nov 1, 2024
52c7529
Merge branch 'state-transition-add-UTs' into fix-update-balance-upon-…
abi87 Nov 1, 2024
420f621
Merge branch 'state-transition-add-UTs' into fix-maximum-number-withd…
abi87 Nov 1, 2024
561f95f
Merge branch 'fix-maximum-number-withdrawals' into validator-size-cap
abi87 Nov 2, 2024
09eee8e
Merge branch 'fix-erigon' into fix-maximum-number-withdrawals
abi87 Nov 2, 2024
11c551e
Merge branch 'fix-erigon' into harden-proposer-validation
abi87 Nov 2, 2024
72539e0
Merge branch 'fix-maximum-number-withdrawals' into validator-size-cap
abi87 Nov 4, 2024
62704e5
Merge branch 'main' into improve-blob-processor-encapsulation
abi87 Nov 4, 2024
d8a267e
hacked fix for withdrawals SSZ serialization
abi87 Nov 4, 2024
3603f6b
Merge branch 'fix-maximum-number-withdrawals' into validator-size-cap
abi87 Nov 4, 2024
32fbbbc
nits
abi87 Nov 4, 2024
54c9b75
Merge branch 'main' into fixed-ExecutionPayload-marshalling
abi87 Nov 5, 2024
2c36828
Merge branch 'main' into harden-verifyChainIDAndConnection
abi87 Nov 5, 2024
23340c6
Merge branch 'harden-verifyChainIDAndConnection' into spear-branch-2
abi87 Nov 5, 2024
f8d281c
Merge branch 'main' into check-PayloadBuilder-enabled
abi87 Nov 5, 2024
3fe1f7d
Merge branch 'check-PayloadBuilder-enabled' into spear-branch-2
abi87 Nov 5, 2024
b2433cf
Merge branch 'main' into node-api-ValidateValidatorStatus
abi87 Nov 5, 2024
01c9d2e
Merge branch 'node-api-ValidateValidatorStatus' into spear-branch-2
abi87 Nov 5, 2024
a9e31f8
Merge branch 'main' into node-api-default-address
abi87 Nov 5, 2024
24570b3
Merge branch 'node-api-default-address' into spear-branch-2
abi87 Nov 5, 2024
c5288a9
Merge branch 'main' into hardened-node-api-custom-validator
abi87 Nov 5, 2024
f75009a
Merge branch 'hardened-node-api-custom-validator' into spear-branch-2
abi87 Nov 5, 2024
c7777e9
Merge branch 'fix-erigon' into spear-branch-2
abi87 Nov 5, 2024
3e84eb5
Merge branch 'consensus_decorated_events' into spear-branch-2
abi87 Nov 5, 2024
6e63668
Merge branch 'main' into ConvertAmount-avoid-truncation
abi87 Nov 5, 2024
8333e76
Merge branch 'ConvertAmount-avoid-truncation' into spear-branch-2
abi87 Nov 5, 2024
f954810
Merge branch 'main' into update-mimetype-dep
abi87 Nov 5, 2024
c3d7c90
Merge branch 'update-mimetype-dep' into spear-branch-2
abi87 Nov 5, 2024
4f42385
Merge branch 'improve-blob-processor-encapsulation' into spear-branch-2
abi87 Nov 5, 2024
643c7ba
Merge branch 'coherent-effectiveBalanceIncrement' into spear-branch-2
abi87 Nov 5, 2024
e48d051
Merge branch 'state-transition-add-UTs' into spear-branch-2
abi87 Nov 5, 2024
1b058b4
Merge branch 'fix-update-balance-upon-deposit' into spear-branch-2
abi87 Nov 5, 2024
2e7f198
Merge branch 'fix-maximum-number-withdrawals' into spear-branch-2
abi87 Nov 5, 2024
2acfa5f
Merge branch 'validator-size-cap' into spear-branch-2
abi87 Nov 5, 2024
2811de8
inject validator address verification function from ctor to ease up t…
abi87 Nov 5, 2024
2c7f448
Merge branch 'state-transition-add-UTs' into harden-proposer-validation
abi87 Nov 5, 2024
14913e4
Merge branch 'harden-proposer-validation' into spear-branch-2
abi87 Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ packages:
recursive: False
with-expecter: true
all: True
github.com/berachain/beacon-kit/mod/state-transition/pkg/core:
config:
recursive: False
with-expecter: true
include-regex: ExecutionEngine
Comment on lines +71 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Package path in mockery config needs correction

The ExecutionEngine interface is defined in mod/beacon/blockchain package, but the mockery configuration is targeting github.com/berachain/beacon-kit/mod/state-transition/pkg/core. This mismatch means the mock generation will not find the intended interface.

  • Update the package path in .mockery.yaml to target the correct location: github.com/berachain/beacon-kit/mod/beacon/blockchain
🔗 Analysis chain

LGTM! Configuration follows established patterns.

The new package configuration is well-structured and consistent with other entries. The settings are appropriate for generating focused mocks of execution engine interfaces.

Let's verify that the regex pattern matches the intended interfaces:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of ExecutionEngine interfaces in the specified package
# Expected: Find interface definitions matching the ExecutionEngine pattern

# Test: Search for ExecutionEngine interfaces in the specified package
fd -e go . | xargs rg -l 'type.*ExecutionEngine.*interface' || echo "No matching interfaces found"

Length of output: 92


Script:

#!/bin/bash
# Let's check the actual interface definition to understand if it's in the correct package
rg -A 5 'type.*ExecutionEngine.*interface' mod/beacon/blockchain/types.go

# Also verify if there are any ExecutionEngine interfaces in the state-transition package
fd -e go . mod/state-transition | xargs rg -l 'type.*ExecutionEngine.*interface' || echo "No matching interfaces found in state-transition"

Length of output: 524

Comment on lines +71 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Fix indentation to maintain consistency.

The configuration looks good, but the indentation appears to be using spaces while the rest of the file uses tabs. Please maintain consistent indentation throughout the file.

-  github.com/berachain/beacon-kit/mod/state-transition/pkg/core:
-    config:
-      recursive: False
-      with-expecter: true
-      include-regex: ExecutionEngine
+	github.com/berachain/beacon-kit/mod/state-transition/pkg/core:
+		config:
+			recursive: False
+			with-expecter: true
+			include-regex: ExecutionEngine
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
github.com/berachain/beacon-kit/mod/state-transition/pkg/core:
config:
recursive: False
with-expecter: true
include-regex: ExecutionEngine
github.com/berachain/beacon-kit/mod/state-transition/pkg/core:
config:
recursive: False
with-expecter: true
include-regex: ExecutionEngine

11 changes: 5 additions & 6 deletions beacond/cmd/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ func DefaultComponents() []any {
*BlobSidecar, *BlobSidecars, *Logger,
],
components.ProvideBlobProofVerifier,
components.ProvideBlobVerifier[
*BeaconBlockHeader, *BlobSidecar, *BlobSidecars,
],
components.ProvideChainService[
*AvailabilityStore, *BeaconBlock, *BeaconBlockBody,
*AvailabilityStore,
*ConsensusBlock, *BeaconBlock, *BeaconBlockBody,
*BeaconBlockHeader, *BeaconState, *BeaconStateMarshallable,
*BlobSidecars, *BlockStore, *Deposit, *DepositStore,
*ExecutionPayload, *ExecutionPayloadHeader, *Genesis,
Expand Down Expand Up @@ -91,7 +89,7 @@ func DefaultComponents() []any {
],
components.ProvideDepositStore[*Deposit],
components.ProvideDispatcher[
*BeaconBlock, *BlobSidecars, *Genesis, *Logger,
*ConsensusBlock, *BeaconBlock, *BlobSidecars, *Genesis, *Logger,
],
components.ProvideEngineClient[
*ExecutionPayload, *ExecutionPayloadHeader, *Logger,
Expand All @@ -107,7 +105,8 @@ func DefaultComponents() []any {
components.ProvideReportingService[*Logger],
components.ProvideCometBFTService[*Logger],
components.ProvideServiceRegistry[
*AvailabilityStore, *BeaconBlock, *BeaconBlockBody,
*AvailabilityStore,
*ConsensusBlock, *BeaconBlock, *BeaconBlockBody,
Comment on lines +108 to +109
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

LGTM: Consider documenting the parameter grouping pattern.

The parameter additions to ProvideServiceRegistry are consistent with other changes. The ordering pattern (stores first, then block types, followed by API context) is logical but could benefit from documentation.

Consider adding a comment above the function to explain the parameter grouping pattern, making it easier for future maintainers to follow the same convention when adding new parameters.

*BeaconBlockHeader, *BlockStore, *BeaconState,
*BeaconStateMarshallable, *BlobSidecar, *BlobSidecars,
*Deposit, *DepositStore, *ExecutionPayload, *ExecutionPayloadHeader,
Expand Down
21 changes: 2 additions & 19 deletions beacond/cmd/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/berachain/beacon-kit/mod/beacon/validator"
"github.com/berachain/beacon-kit/mod/consensus-types/pkg/types"
cometbft "github.com/berachain/beacon-kit/mod/consensus/pkg/cometbft/service"
"github.com/berachain/beacon-kit/mod/consensus/pkg/cometbft/service/middleware"
consruntimetypes "github.com/berachain/beacon-kit/mod/consensus/pkg/types"
dablob "github.com/berachain/beacon-kit/mod/da/pkg/blob"
"github.com/berachain/beacon-kit/mod/da/pkg/da"
Expand Down Expand Up @@ -63,14 +62,6 @@ import (
/* -------------------------------------------------------------------------- */

type (
// ABCIMiddleware is a type alias for the ABCIMiddleware.
ABCIMiddleware = middleware.ABCIMiddleware[
*BeaconBlock,
*BlobSidecars,
*Genesis,
*SlotData,
]

// AttributesFactory is a type alias for the attributes factory.
AttributesFactory = attributes.Factory[
*BeaconState,
Expand All @@ -87,19 +78,13 @@ type (
*BlobSidecars,
]

// BlobVerifier is a type alias for the blob verifier.
BlobVerifier = dablob.Verifier[
*BeaconBlockHeader,
*BlobSidecar,
*BlobSidecars,
]

// BlockStoreService is a type alias for the block store service.
BlockStoreService = blockstore.Service[*BeaconBlock, *BlockStore]

// ChainService is a type alias for the chain service.
ChainService = blockchain.Service[
*AvailabilityStore,
*ConsensusBlock,
*BeaconBlock,
*BeaconBlockBody,
*BeaconBlockHeader,
Expand All @@ -114,9 +99,6 @@ type (
// CometBFTService is a type alias for the CometBFT service.
CometBFTService = cometbft.Service[*Logger]

// ConsensusMiddleware is a type alias for the consensus middleware.
ConsensusMiddleware = cometbft.MiddlewareI

// DAService is a type alias for the DA service.
DAService = da.Service[*AvailabilityStore, *BlobSidecars]

Expand Down Expand Up @@ -245,6 +227,7 @@ type (
AvailabilityStore = dastore.Store[*BeaconBlockBody]

// BeaconBlock type aliases.
ConsensusBlock = consruntimetypes.ConsensusBlock[*BeaconBlock]
BeaconBlock = types.BeaconBlock
BeaconBlockBody = types.BeaconBlockBody
BeaconBlockHeader = types.BeaconBlockHeader
Expand Down
12 changes: 6 additions & 6 deletions beacond/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/ferranbt/fastssz v0.1.4-0.20240629094022-eac385e6ee79 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.6 // indirect
github.com/getsentry/sentry-go v0.28.1 // indirect
github.com/go-faster/xor v1.0.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
Expand Down Expand Up @@ -236,13 +236,13 @@ require (
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect
Expand Down
24 changes: 12 additions & 12 deletions beacond/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I=
github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s=
github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc=
github.com/gabriel-vasile/mimetype v1.4.6/go.mod h1:JX1qVKqZd40hUPpAfiNTe0Sne7hdfKSbOqqmkq8GCXc=
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays=
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k=
Expand Down Expand Up @@ -688,8 +688,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
Expand Down Expand Up @@ -718,8 +718,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -771,19 +771,19 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
4 changes: 2 additions & 2 deletions build/scripts/testing.mk
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ start-erigon: ## start an ephemeral `erigon` node
docker run \
--rm -v $(PWD)/${TESTAPP_FILES_DIR}:/${TESTAPP_FILES_DIR} \
-v $(PWD)/.tmp:/.tmp \
thorax/erigon:latest init \
erigontech/erigon:latest init \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using a specific version tag instead of 'latest'.

Good move switching to the official erigontech/erigon repository. However, using the :latest tag can lead to reproducibility issues as it may pull different versions at different times. Consider pinning to a specific version (e.g., erigontech/erigon:v2.60.9 as used in other files) to ensure consistent behavior across environments.

-    erigontech/erigon:latest init \
+    erigontech/erigon:v2.60.9 init \
...
-    erigontech/erigon:latest \
+    erigontech/erigon:v2.60.9 \

Also applies to: 215-215

--datadir .tmp/erigon \
${ETH_GENESIS_PATH}
Comment on lines +205 to 207
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider using a specific version tag instead of 'latest'.

The change to use the official erigontech/erigon image is good, but using the latest tag can lead to reproducibility issues. Consider pinning to a specific version that matches the one used in Kurtosis configurations (v2.60.9).

-    erigontech/erigon:latest init \
+    erigontech/erigon:v2.60.9 init \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
erigontech/erigon:latest init \
--datadir .tmp/erigon \
${ETH_GENESIS_PATH}
erigontech/erigon:v2.60.9 init \
--datadir .tmp/erigon \
${ETH_GENESIS_PATH}


Expand All @@ -212,7 +212,7 @@ start-erigon: ## start an ephemeral `erigon` node
-p 8551:8551 \
--rm -v $(PWD)/${TESTAPP_FILES_DIR}:/${TESTAPP_FILES_DIR} \
-v $(PWD)/.tmp:/.tmp \
thorax/erigon:latest \
erigontech/erigon:latest \
--http \
--http.addr 0.0.0.0 \
--http.api eth,net \
Expand Down
2 changes: 1 addition & 1 deletion kurtosis/beaconkit-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ node_settings:
max_memory: 2048
images:
besu: hyperledger/besu:24.5.4
erigon: thorax/erigon:v2.60.1
erigon: erigontech/erigon:v2.60.9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Document the repository change from 'thorax' to 'erigontech'.

While switching to the official repository is a good practice, please document the rationale for this change in the commit message or PR description to help with future maintenance.

ethereumjs: ethpandaops/ethereumjs:stable
geth: ethereum/client-go:latest
nethermind: nethermind/nethermind:latest
Expand Down
2 changes: 1 addition & 1 deletion kurtosis/beaconkit-base-gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ node_settings:
max_memory: 32768
images:
besu: hyperledger/besu:latest
erigon: thorax/erigon:v2.60.1
erigon: erigontech/erigon:v2.60.9
ethereumjs: ethpandaops/ethereumjs:stable
geth: ethereum/client-go:latest
nethermind: nethermind/nethermind:latest
Expand Down
2 changes: 1 addition & 1 deletion kurtosis/src/nodes/consensus/beacond/node.star
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def start(persistent_peers, is_seed, validator_index, config_settings, app_setti
--beacon-kit.kzg.implementation={} \
--beacon-kit.engine.rpc-dial-url {} \
--beacon-kit.block-store-service.enabled \
--beacon-kit.node-api.enabled --beacon-kit.node-api.logging \
--beacon-kit.node-api.enabled --beacon-kit.node-api.logging --beacon-kit.node-api.address 0.0.0.0:3500 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider parameterizing the node API configuration.

The addition of the node API configuration is consistent with the test environment setup. However, binding to 0.0.0.0 exposes the API on all network interfaces.

Consider:

  1. Making the API address configurable through config_settings like other parameters
  2. Adding a comment indicating this is for testing purposes only
  3. If this configuration will be used in production, consider:
    • Binding to localhost by default
    • Adding authentication mechanisms
    • Documenting security implications

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

💡 Codebase verification

Based on the code analysis, I can now generate the final response:

API security needs to be enhanced before exposing to external networks

The current implementation:

  1. Only has basic CORS middleware with default configuration
  2. Lacks authentication/authorization mechanisms
  3. Has no rate limiting or request validation beyond basic parameter validation

While binding to 0.0.0.0 allows external access, the API should either:

  • Be restricted to localhost (127.0.0.1) if only local access is needed
  • Have proper security measures (authentication, rate limiting, etc.) implemented before exposing externally
🔗 Analysis chain

Consider security implications and configuration flexibility of the node API.

The hardcoded API address 0.0.0.0:3500 has several implications:

  1. Security: Binding to 0.0.0.0 exposes the API to all network interfaces. Consider restricting to localhost (127.0.0.1) if external access isn't required.
  2. Flexibility: Hardcoding the address/port limits configuration options. Consider making these configurable via environment variables or config file.

Let's verify if this API endpoint is protected elsewhere in the codebase:


Let me analyze the search results to verify the security implications of exposing the node API:

  1. The node API is part of the beacon-kit module and has several handlers for different functionalities (beacon, builder, config, debug, events, node, proof)
  2. The API configuration is controlled through config files and flags:
    • enabled flag to enable/disable the API
    • address to control binding address
    • logging for API logging
  3. Looking at testing/networks/80084/app.toml, the default configuration has the API disabled:
[beacon-kit.node-api]
enabled = "false"
address = "0.0.0.0:3500"
  1. The API uses Echo framework with middleware (mod/node-api/engines/echo/middleware.go) for request handling

Let me verify if there are any authentication/authorization mechanisms:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any authentication/security middleware for the node API
rg -A 5 "node-api" 

Length of output: 50121


Script:

#!/bin/bash
# Search for auth middleware or security-related code
rg -A 5 "middleware|auth|security" mod/node-api/

Length of output: 1302

--pruning=nothing \
{} {}".format(kzg_impl, "$BEACOND_ENGINE_DIAL_URL", seed_option, persistent_peers_option)

Expand Down
2 changes: 1 addition & 1 deletion kurtosis/src/nodes/nodes.star
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ EXECUTION_DEFAULT_SETTINGS = {
},
"images": {
"besu": "hyperledger/besu:latest",
"erigon": "thorax/erigon:v2.60.1",
"erigon": "erigontech/erigon:v2.60.9",
"ethereumjs": "ethpandaops/ethereumjs:stable",
"geth": "ethereum/client-go:latest",
"nethermind": "nethermind/nethermind:latest",
Expand Down
33 changes: 17 additions & 16 deletions mod/beacon/blockchain/execution_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ package blockchain
import (
"context"

payloadtime "github.com/berachain/beacon-kit/mod/beacon/payload-time"
engineprimitives "github.com/berachain/beacon-kit/mod/engine-primitives/pkg/engine-primitives"
)

// sendPostBlockFCU sends a forkchoice update to the execution client.
func (s *Service[
_, BeaconBlockT, _, _, BeaconStateT, _, _, _, _, _,
_, ConsensusBlockT, _, _, _, BeaconStateT, _, _, _, _, _,
]) sendPostBlockFCU(
ctx context.Context,
st BeaconStateT,
blk BeaconBlockT,
blk ConsensusBlockT,
) {
lph, err := st.GetLatestExecutionPayloadHeader()
if err != nil {
Expand All @@ -54,18 +53,19 @@ func (s *Service[
// sendNextFCUWithAttributes sends a forkchoice update to the execution
// client with attributes.
func (s *Service[
_, BeaconBlockT, _, _, BeaconStateT,
_, ConsensusBlockT, _, _, _, BeaconStateT,
_, _, ExecutionPayloadHeaderT, _, _,
]) sendNextFCUWithAttributes(
ctx context.Context,
st BeaconStateT,
blk BeaconBlockT,
blk ConsensusBlockT,
lph ExecutionPayloadHeaderT,
) {
var err error
beaconBlk := blk.GetBeaconBlock()

Comment on lines +64 to +65
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider adding a helper method for beacon block retrieval

Multiple methods perform the same block retrieval operation. Consider extracting this into a helper method with consistent error handling.

+func (s *Service[_, ConsensusBlockT, ...]) getBeaconBlockWithLogging(
+    blk ConsensusBlockT,
+) (BeaconBlockT, error) {
+    beaconBlk, err := blk.GetBeaconBlock()
+    if err != nil {
+        s.logger.Error("failed to get beacon block", "error", err)
+        return nil, err
+    }
+    return beaconBlk, nil
+}

Also applies to: 105-106


⚠️ Potential issue

Add error handling for GetBeaconBlock

The GetBeaconBlock() call should include error handling to ensure graceful failure if the beacon block cannot be retrieved.

-beaconBlk := blk.GetBeaconBlock()
+beaconBlk, err := blk.GetBeaconBlock()
+if err != nil {
+    s.logger.Error("failed to get beacon block", "error", err)
+    return
+}

Committable suggestion skipped: line range outside the PR's diff.

stCopy := st.Copy()
if _, err = s.stateProcessor.ProcessSlots(
stCopy, blk.GetSlot()+1,
if _, err := s.stateProcessor.ProcessSlots(
stCopy, beaconBlk.GetSlot()+1,
); err != nil {
s.logger.Error(
"failed to process slots in non-optimistic payload",
Expand All @@ -74,13 +74,12 @@ func (s *Service[
return
}

prevBlockRoot := blk.HashTreeRoot()
payloadTime := blk.GetBody().GetExecutionPayload().GetTimestamp()
if _, err = s.localBuilder.RequestPayloadAsync(
prevBlockRoot := beaconBlk.HashTreeRoot()
if _, err := s.localBuilder.RequestPayloadAsync(
ctx,
stCopy,
blk.GetSlot()+1,
payloadtime.Next(s.chainSpec, payloadTime),
beaconBlk.GetSlot()+1,
blk.GetNextPayloadTimestamp().Unwrap(),
prevBlockRoot,
lph.GetBlockHash(),
lph.GetParentHash(),
Expand All @@ -96,13 +95,15 @@ func (s *Service[
// sendNextFCUWithoutAttributes sends a forkchoice update to the
// execution client without attributes.
func (s *Service[
_, BeaconBlockT, _, _, _, _, _,
_, ConsensusBlockT, _, _, _, _, _, _,
ExecutionPayloadHeaderT, _, PayloadAttributesT,
]) sendNextFCUWithoutAttributes(
ctx context.Context,
blk BeaconBlockT,
blk ConsensusBlockT,
lph ExecutionPayloadHeaderT,
) {
beaconBlk := blk.GetBeaconBlock()

Comment on lines +105 to +106
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add error handling for GetBeaconBlock

Similar to the previous method, add error handling for the GetBeaconBlock call.

-beaconBlk := blk.GetBeaconBlock()
+beaconBlk, err := blk.GetBeaconBlock()
+if err != nil {
+    s.logger.Error("failed to get beacon block", "error", err)
+    return
+}

Committable suggestion skipped: line range outside the PR's diff.

if _, _, err := s.executionEngine.NotifyForkchoiceUpdate(
ctx,
// TODO: Switch to New().
Expand All @@ -113,7 +114,7 @@ func (s *Service[
SafeBlockHash: lph.GetParentHash(),
FinalizedBlockHash: lph.GetParentHash(),
},
s.chainSpec.ActiveForkVersionForSlot(blk.GetSlot()),
s.chainSpec.ActiveForkVersionForSlot(beaconBlk.GetSlot()),
),
); err != nil {
s.logger.Error(
Expand Down
Loading
Loading