Skip to content

Commit

Permalink
Merge branch 'main' into bet3
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear committed May 29, 2024
2 parents 7035e19 + 86d8c18 commit 58a4f6d
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 227 deletions.
3 changes: 1 addition & 2 deletions kurtosis/beaconkit-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ eth_json_rpc_endpoints:
- el-full-besu-4
- el-full-erigon-5
- el-full-ethereumjs-6
additional_services:
additional_services:
- "goomy_blob"
- "tx-fuzz"
- "prometheus"
- "grafana"
- "pyroscope"

49 changes: 28 additions & 21 deletions kurtosis/main.star
Original file line number Diff line number Diff line change
Expand Up @@ -161,26 +161,33 @@ def run(plan, validators, full_nodes = [], eth_json_rpc_endpoints = [], boot_seq
goomy_blob_args,
)
plan.print("Successfully launched goomy the blob spammer")

if "tx-fuzz" in additional_services:
plan.print("Launching tx-fuzz")
fuzzing_node = validator_node_el_clients[0]["service"]
if len(full_nodes) > 0:
fuzzing_node = full_node_el_clients[0]["service"]
tx_fuzz.launch_tx_fuzz(
plan,
constants.PRE_FUNDED_ACCOUNTS[1].private_key,
"http://{}:{}".format(fuzzing_node.ip_address, execution.RPC_PORT_NUM),
[],
)

if "prometheus" in additional_services:
prometheus_url = prometheus.start(plan, metrics_enabled_services)

if "grafana" in additional_services:
grafana.start(plan, prometheus_url)

if "pyroscope" in additional_services:
pyroscope.run(plan)
elif s == "blutgang":
plan.print("Launghing blutgang")
blutgang_config_template = read_file(
constants.BLUTGANG_CONFIG_TEMPLATE_PATH,
)
blutgang.launch_blutgang(
plan,
blutgang_config_template,
constants.PRE_FUNDED_ACCOUNTS[0],
plan.get_service("nginx").ports["http"].url,
)
elif s == "tx-fuzz":
plan.print("Launching tx-fuzz")
fuzzing_node = validator_node_el_clients[0]["service"]
if len(full_nodes) > 0:
fuzzing_node = full_node_el_clients[0]["service"]
tx_fuzz.launch_tx_fuzz(
plan,
constants.PRE_FUNDED_ACCOUNTS[1].private_key,
"http://{}:{}".format(fuzzing_node.ip_address, execution.RPC_PORT_NUM),
[],
)
elif s == "prometheus":
prometheus_url = prometheus.start(plan, metrics_enabled_services)
if "grafana" in additional_services:
grafana.start(plan, prometheus_url)
if "pyroscope" in additional_services:
pyroscope.run(plan)

plan.print("Successfully launched development network")
12 changes: 10 additions & 2 deletions mod/beacon/validator/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
"context"
"time"

engineerrors "github.com/berachain/beacon-kit/mod/engine-primitives/pkg/errors"
"github.com/berachain/beacon-kit/mod/errors"
"github.com/berachain/beacon-kit/mod/primitives"
"github.com/berachain/beacon-kit/mod/primitives/pkg/transition"
)
Expand Down Expand Up @@ -83,8 +85,14 @@ func (s *Service[
SkipValidateRandao: false,
},
st, blk,
); err != nil {
// TODO: If we get ACCEPTED, should we roll with it?
); errors.Is(err, engineerrors.ErrAcceptedPayloadStatus) {
// It is safe for the validator to ignore this error since
// the state transition will enforce that the block is part
// of the canonical chain.
//
// TODO: this is only true because we are assuming SSF.
return nil
} else if err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion mod/node-builder/pkg/commands/deposit/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (

// NewValidateDeposit creates a new command for validating a deposit message.
//
//nolint:gomnd // lots of magic numbers

func NewCreateValidator(chainSpec primitives.ChainSpec) *cobra.Command {
cmd := &cobra.Command{
Use: "create-validator",
Expand Down
2 changes: 1 addition & 1 deletion mod/primitives/pkg/transition/validator_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ type ValidatorUpdate struct {
// Pubkey is the public key of the validator.
Pubkey crypto.BLSPubkey

// EffectiveBalance
// EffectiveBalance is the effective balance of the validator.
EffectiveBalance math.Gwei
}
35 changes: 20 additions & 15 deletions mod/state-transition/pkg/core/state_processor_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,29 @@ func (sp *StateProcessor[
withdrawalsRoot primitives.Root
)

lph, err := st.GetLatestExecutionPayloadHeader()
if err != nil {
return err
}

// We want to check to ensure the chain is canonical with respect to the
// parent hash before we let the execution client know about the payload,
// this is to prevent Polygon style re-orgs from being triggered by a
// malicious actor who tries to force clients to accept a non-canonical
// block that passes block validity checks.
if safeHash := lph.GetBlockHash(); safeHash != payload.GetParentHash() {
return errors.Wrapf(
ErrParentRootMismatch,
"parent block with hash %x is not finalized, expected finalized hash %x",
payload.GetParentHash(),
safeHash,
)
}

// Verify and notify the new payload early in the function.
parentBeaconBlockRoot := blk.GetParentBlockRoot()
g.Go(func() error {
if err := sp.executionEngine.VerifyAndNotifyNewPayload(
if err = sp.executionEngine.VerifyAndNotifyNewPayload(
gCtx, engineprimitives.BuildNewPayloadRequest(
payload,
body.GetBlobKzgCommitments().ToVersionedHashes(),
Expand Down Expand Up @@ -93,20 +112,6 @@ func (sp *StateProcessor[
return withdrawalsRootErr
})

lph, err := st.GetLatestExecutionPayloadHeader()
if err != nil {
return err
}

if safeHash := lph.GetBlockHash(); safeHash != payload.GetParentHash() {
return errors.Wrapf(
ErrParentRootMismatch,
"parent block with hash %x is not finalized, expected finalized hash %x",
payload.GetParentHash(),
safeHash,
)
}

// Get the current epoch.
slot, err := st.GetSlot()
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions testing/e2e/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func DefaultE2ETestConfig() *E2ETestConfig {
ElType: "reth",
ClImage: "beacond:kurtosis-local",
ClType: "beaconkit",
Replicas: 1,
Replicas: 2, //nolint:mnd // 2 replicas
},
{
ElType: "erigon",
Expand All @@ -117,7 +117,7 @@ func DefaultE2ETestConfig() *E2ETestConfig {
ElType: "reth",
ClImage: "beacond:kurtosis-local",
ClType: "beaconkit",
Replicas: 1,
Replicas: 2, //nolint:mnd // 2 replicas
},
{
ElType: "geth",
Expand Down Expand Up @@ -147,7 +147,7 @@ func DefaultE2ETestConfig() *E2ETestConfig {
Clients: []string{
"el-full-nethermind-0",
"el-full-reth-1",
"el-full-geth-2",
"el-full-geth-3",
// "el-full-erigon-3",
// Besu causing flakey tests.
// "el-full-besu-4",
Expand Down
Loading

0 comments on commit 58a4f6d

Please sign in to comment.