mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
Bellatrix evaluators (#10506)
* defensive nil check * separate ExecutionPayload/Header from codegen * tell bazel about this new file * Merge: support terminal difficulty override (#9769) * Fix finding terminal block hash calculation * Update mainnet_config.go * Update beacon_block.pb.go * Various fixes to pass all spec tests for Merge (#9777) * Proper upgrade altair to merge state * Use uint64 for ttd * Correctly upgrade to merge state + object mapping fixes * Use proper receive block path for initial syncing * Disable contract lookback * Disable deposit contract lookback * Go fmt * Merge: switch from go bindings to raw rpc calls (#9803) * Disable genesis ETH1.0 chain header logging * Update htrutils.go * all gossip tests passing * Remove gas validations * Update penalty params for Merge * Fix gossip and tx size limits for the merge part 1 * Remove extraneous p2p condition * Add and use * Add and use TBH_ACTIVATION_EPOCH * Update WORKSPACE * Update Kintsugi engine API (#9865) * Kintsugi ssz (#9867) * All spec tests pass * Update spec test shas * Update Kintsugi consensus implementations (#9872) * Remove secp256k1 * Remove unused merge genesis state gen tool * Manually override nil transaction field. M2 works * Fix bad hex conversion * Change Gossip message size and Chunk SIze from 1 MB t0 10MB (#9860) * change gossip size and chunk size after merge * change ssz to accomodate both changes * gofmt config file * add testcase for merge MsgId * Update beacon-chain/p2p/message_id.go Change MB to Mib in comment Co-authored-by: terence tsao <terence@prysmaticlabs.com> * change function name from altairMsgID to postAltairMsgID Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Sync with develop * Merge branch 'develop' of github.com:prysmaticlabs/prysm into kintsugi * Update state_trie.go * Clean up conflicts * Fix build * Update config to devnet1 * Fix state merge * Handle merge test case for update balance * Fix build * State pkg cleanup * Fix a bug with loading mainnet state * Fix transactions root * Add v2 endpoint for merge blocks (#9802) * Add V2 blocks endpoint for merge blocks * Update beacon-chain/rpc/apimiddleware/structs.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * go mod * fix transactions * Terence's comments * add missing file Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Sync * Go mod tidy * change EP field names * latest kintusgi execution api * fix conflicts * converting base fee to big endian format (#10018) * ReverseByteOrder function does not mess the input * sync with develop * use merge gossip sizes * correct gossip sizes this time * visibility * clean ups * Sync with develop, fix payload nil check bug * Speed up syncing, hide cosmetic errors * Sync with develop * Clean up after sync * Update generate_keys.go * sync with develop * Update mainnet_config.go * Clean ups * Sync optimistically candidate blocks (#10193) * Revert "Sync optimistically candidate blocks (#10193)" This reverts commitf99a0419ef. * Sync optimistically candidate blocks (#10193) * allow optimistic sync * Fix merge transition block validation * Update proposer.go * Sync with develop * delete deprecated client, update testnet flag * Change optimistic logic (#10194) * Logs and err handling * Fix build * Clean ups * Add back get payload * c * Done * Rm uncommented * Optimistic sync: prysm validator rpcs (#10200) * Logs to reproduce * Use pointers * Use pointers * Use pointers * Update json_marshal_unmarshal.go * Fix marshal * Update json_marshal_unmarshal.go * Log * string total diff * str * marshal un * set string * json * gaz * Comment out optimistic status * remove kiln flag here (#10269) * Sync with devleop * Sync with develop * clean ups * refactor engine calls * Update process_block.go * Fix deadlock, uncomment duty opt sync * Update proposer_execution_payload.go * Sync with develop * Rm post state check * Bypass eth1 data checks * Update proposer_execution_payload.go * Return early if ttd is not reached * Sync with devleop * Update process_block.go * Update receive_block.go * Update bzl * Revert "Update receive_block.go" This reverts commit5b4a87c512. * Fix run time * add in all the fixes * fix evaluator bugs * latest fixes * sum * fix to be configurable * Update go.mod * Fix AltairCompatible to account for future state version * Update proposer_execution_payload.go * fix broken conditional checks * fix all issues * Handle pre state Altair with valid payload * Handle pre state Altair with valid payload * Log bellatrix fields * Update log.go * Revert "fix broken conditional checks" This reverts commite118db6c20. * LH multiclient working * Friendly fee recipient log * Remove extra SetOptimisticToValid * fix race * fix test * Fix base fee per gas * Fix notifypayload headroot * tx fuzzer * clean up with develop branch * save progress * 200tx/block * add LH flags * Sync with devleop * cleanup * cleanup * hash * fix build * fix test * fix go check * fmt * gosec * Blocked stream (cherry picked from commit f362af9862db680b6352692217ad5c08d44a1e86) # Conflicts: # proto/prysm/v1alpha1/validator.pb.go * remove duplicate param * test * revert some test changes * Initial version of EE tx count * evaluate all txs in epoch * remove logs * uncomment tests * remove unwanted change * parameterize ExpectedExecEngineTxsThreshold Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: Zahoor Mohamed <zahoor@zahoor.in> Co-authored-by: kasey <489222+kasey@users.noreply.github.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com> Co-authored-by: Zahoor Mohamed <zahoor@prysmaticlabs.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -37,17 +37,24 @@ func (vs *Server) StreamBlocksAltair(req *ethpb.StreamBlocksRequest, stream ethp
|
||||
case version.Phase0:
|
||||
phBlk, ok := data.SignedBlock.Proto().(*ethpb.SignedBeaconBlock)
|
||||
if !ok {
|
||||
log.Warn("Mismatch between version and block type, was expecting *ethpb.SignedBeaconBlock")
|
||||
log.Warn("Mismatch between version and block type, was expecting SignedBeaconBlock")
|
||||
continue
|
||||
}
|
||||
b.Block = ðpb.StreamBlocksResponse_Phase0Block{Phase0Block: phBlk}
|
||||
case version.Altair:
|
||||
phBlk, ok := data.SignedBlock.Proto().(*ethpb.SignedBeaconBlockAltair)
|
||||
if !ok {
|
||||
log.Warn("Mismatch between version and block type, was expecting *v2.SignedBeaconBlockAltair")
|
||||
log.Warn("Mismatch between version and block type, was expecting SignedBeaconBlockAltair")
|
||||
continue
|
||||
}
|
||||
b.Block = ðpb.StreamBlocksResponse_AltairBlock{AltairBlock: phBlk}
|
||||
case version.Bellatrix:
|
||||
phBlk, ok := data.SignedBlock.Proto().(*ethpb.SignedBeaconBlockBellatrix)
|
||||
if !ok {
|
||||
log.Warn("Mismatch between version and block type, was expecting SignedBeaconBlockBellatrix")
|
||||
continue
|
||||
}
|
||||
b.Block = ðpb.StreamBlocksResponse_BellatrixBlock{BellatrixBlock: phBlk}
|
||||
}
|
||||
|
||||
if err := stream.Send(b); err != nil {
|
||||
|
||||
@@ -45,7 +45,7 @@ func E2ETestConfig() *BeaconChainConfig {
|
||||
e2eConfig.DepositChainID = 1337 // Chain ID of eth1 dev net.
|
||||
e2eConfig.DepositNetworkID = 1337 // Network ID of eth1 dev net.
|
||||
|
||||
// Altair Fork Parameters.
|
||||
// Fork Parameters.
|
||||
e2eConfig.AltairForkEpoch = altairE2EForkEpoch
|
||||
e2eConfig.BellatrixForkEpoch = bellatrixE2EForkEpoch
|
||||
|
||||
|
||||
1546
proto/prysm/v1alpha1/validator.pb.go
generated
1546
proto/prysm/v1alpha1/validator.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -360,6 +360,9 @@ message StreamBlocksResponse {
|
||||
|
||||
// Representing an altair block.
|
||||
SignedBeaconBlockAltair altair_block = 2;
|
||||
|
||||
// Representing a bellatrix block.
|
||||
SignedBeaconBlockBellatrix bellatrix_block = 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ go_library(
|
||||
"api_gateway_v1alpha1.go",
|
||||
"api_middleware.go",
|
||||
"data.go",
|
||||
"execution_engine.go",
|
||||
"finality.go",
|
||||
"fork.go",
|
||||
"metrics.go",
|
||||
|
||||
54
testing/endtoend/evaluators/execution_engine.go
Normal file
54
testing/endtoend/evaluators/execution_engine.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package evaluators
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/config/params"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/testing/endtoend/helpers"
|
||||
e2e "github.com/prysmaticlabs/prysm/testing/endtoend/params"
|
||||
"github.com/prysmaticlabs/prysm/testing/endtoend/policies"
|
||||
"github.com/prysmaticlabs/prysm/testing/endtoend/types"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// TransactionsPresent is an evaluator to make sure transactions send to the execution engine
|
||||
// appear in consensus client blocks' execution payload.
|
||||
var TransactionsPresent = types.Evaluator{
|
||||
Name: "transactions_present_at_epoch_%d",
|
||||
Policy: policies.AfterNthEpoch(helpers.BellatrixE2EForkEpoch),
|
||||
Evaluation: transactionsPresent,
|
||||
}
|
||||
|
||||
func transactionsPresent(conns ...*grpc.ClientConn) error {
|
||||
conn := conns[0]
|
||||
client := ethpb.NewBeaconChainClient(conn)
|
||||
chainHead, err := client.GetChainHead(context.Background(), &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get chain head")
|
||||
}
|
||||
req := ðpb.ListBlocksRequest{QueryFilter: ðpb.ListBlocksRequest_Epoch{Epoch: chainHead.HeadEpoch.Sub(1)}}
|
||||
blks, err := client.ListBeaconBlocks(context.Background(), req)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get blocks from beacon-chain")
|
||||
}
|
||||
expectedTxNum := int(math.Round(float64(params.E2ETestConfig().SlotsPerEpoch) * float64(e2e.NumOfExecEngineTxs) * e2e.ExpectedExecEngineTxsThreshold))
|
||||
var numberOfTxs int
|
||||
for _, ctr := range blks.BlockContainers {
|
||||
switch ctr.Block.(type) {
|
||||
case *ethpb.BeaconBlockContainer_BellatrixBlock:
|
||||
numberOfTxs += len(ctr.GetBellatrixBlock().Block.Body.ExecutionPayload.Transactions)
|
||||
}
|
||||
}
|
||||
if numberOfTxs < expectedTxNum {
|
||||
return errors.Errorf(
|
||||
"not enough transactions in execution payload, expected=%d vs actual=%d",
|
||||
expectedTxNum,
|
||||
numberOfTxs,
|
||||
)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -14,14 +14,21 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// ForkTransition ensures that the hard fork has occurred successfully.
|
||||
var ForkTransition = types.Evaluator{
|
||||
Name: "fork_transition_%d",
|
||||
// AltairForkTransition ensures that the Altair hard fork has occurred successfully.
|
||||
var AltairForkTransition = types.Evaluator{
|
||||
Name: "altair_fork_transition_%d",
|
||||
Policy: policies.OnEpoch(helpers.AltairE2EForkEpoch),
|
||||
Evaluation: forkOccurs,
|
||||
Evaluation: altairForkOccurs,
|
||||
}
|
||||
|
||||
func forkOccurs(conns ...*grpc.ClientConn) error {
|
||||
// BellatrixForkTransition ensures that the Bellatrix hard fork has occurred successfully.
|
||||
var BellatrixForkTransition = types.Evaluator{
|
||||
Name: "bellatrix_fork_transition_%d",
|
||||
Policy: policies.OnEpoch(helpers.BellatrixE2EForkEpoch),
|
||||
Evaluation: bellatrixForkOccurs,
|
||||
}
|
||||
|
||||
func altairForkOccurs(conns ...*grpc.ClientConn) error {
|
||||
conn := conns[0]
|
||||
client := ethpb.NewBeaconNodeValidatorClient(conn)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@@ -62,3 +69,48 @@ func forkOccurs(conns ...*grpc.ClientConn) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func bellatrixForkOccurs(conns ...*grpc.ClientConn) error {
|
||||
conn := conns[0]
|
||||
client := ethpb.NewBeaconNodeValidatorClient(conn)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
stream, err := client.StreamBlocksAltair(ctx, ðpb.StreamBlocksRequest{VerifiedOnly: true})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get stream")
|
||||
}
|
||||
fSlot, err := slots.EpochStart(helpers.BellatrixE2EForkEpoch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ctx.Err() == context.Canceled {
|
||||
return errors.New("context canceled prematurely")
|
||||
}
|
||||
res, err := stream.Recv()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if res == nil || res.Block == nil {
|
||||
return errors.New("nil block returned by beacon node")
|
||||
}
|
||||
if res.GetPhase0Block() == nil && res.GetAltairBlock() == nil && res.GetBellatrixBlock() == nil {
|
||||
return errors.New("nil block returned by beacon node")
|
||||
}
|
||||
if res.GetPhase0Block() != nil {
|
||||
return errors.New("phase 0 block returned after bellatrix fork has occurred")
|
||||
}
|
||||
if res.GetAltairBlock() != nil {
|
||||
return errors.New("altair block returned after bellatrix fork has occurred")
|
||||
}
|
||||
blk, err := wrapperv2.WrappedSignedBeaconBlock(res.GetBellatrixBlock())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := coreHelper.BeaconBlockIsNil(blk); err != nil {
|
||||
return err
|
||||
}
|
||||
if blk.Block().Slot() < fSlot {
|
||||
return errors.Errorf("wanted a block >= %d but received %d", fSlot, blk.Block().Slot())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -419,5 +419,8 @@ func convertToBlockInterface(obj *ethpb.BeaconBlockContainer) (block.SignedBeaco
|
||||
if obj.GetBellatrixBlock() != nil {
|
||||
return wrapper.WrappedSignedBeaconBlock(obj.GetBellatrixBlock())
|
||||
}
|
||||
if obj.GetBellatrixBlock() != nil {
|
||||
return wrapper.WrappedSignedBeaconBlock(obj.GetBellatrixBlock())
|
||||
}
|
||||
return nil, errors.New("container has no block")
|
||||
}
|
||||
|
||||
@@ -54,11 +54,13 @@ func e2eMainnet(t *testing.T, usePrysmSh bool) {
|
||||
ev.ProposeVoluntaryExit,
|
||||
ev.ValidatorHasExited,
|
||||
ev.ColdStateCheckpoint,
|
||||
ev.ForkTransition,
|
||||
ev.AltairForkTransition,
|
||||
ev.BellatrixForkTransition,
|
||||
ev.APIMiddlewareVerifyIntegrity,
|
||||
ev.APIGatewayV1Alpha1VerifyIntegrity,
|
||||
ev.FinishedSyncing,
|
||||
ev.AllNodesHaveSameHead,
|
||||
ev.TransactionsPresent,
|
||||
}
|
||||
testConfig := &types.E2EConfig{
|
||||
BeaconFlags: []string{
|
||||
|
||||
@@ -83,12 +83,14 @@ func e2eMinimal(t *testing.T, args *testArgs) {
|
||||
ev.ValidatorHasExited,
|
||||
ev.ValidatorsVoteWithTheMajority,
|
||||
ev.ColdStateCheckpoint,
|
||||
ev.ForkTransition,
|
||||
ev.AltairForkTransition,
|
||||
ev.BellatrixForkTransition,
|
||||
ev.APIMiddlewareVerifyIntegrity,
|
||||
ev.APIGatewayV1Alpha1VerifyIntegrity,
|
||||
ev.FinishedSyncing,
|
||||
ev.AllNodesHaveSameHead,
|
||||
ev.ValidatorSyncParticipation,
|
||||
ev.TransactionsPresent,
|
||||
}
|
||||
testConfig := &types.E2EConfig{
|
||||
BeaconFlags: []string{
|
||||
|
||||
@@ -69,6 +69,12 @@ var StandardLighthouseNodeCount = 2
|
||||
// DepositCount is the amount of deposits E2E makes on a separate validator client.
|
||||
var DepositCount = uint64(64)
|
||||
|
||||
// NumOfExecEngineTxs is the number of transaction sent to the execution engine.
|
||||
var NumOfExecEngineTxs = uint64(200)
|
||||
|
||||
// ExpectedExecEngineTxsThreshold is the portion of execution engine transactions we expect to find in blocks.
|
||||
var ExpectedExecEngineTxsThreshold = 0.7
|
||||
|
||||
// Base port values.
|
||||
const (
|
||||
portSpan = 50
|
||||
|
||||
Reference in New Issue
Block a user