Skip to content

Commit

Permalink
Resolve all conflicts under cl/
Browse files Browse the repository at this point in the history
  • Loading branch information
mininny committed Aug 5, 2024
1 parent 45aa005 commit f731d1b
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 167 deletions.
81 changes: 0 additions & 81 deletions cl/beacon/handler/block_production.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,6 @@ import (
"time"

"github.com/go-chi/chi/v5"
<<<<<<< HEAD
"github.com/ledgerwatch/erigon-lib/common"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/hexutil"
"github.com/ledgerwatch/erigon-lib/common/length"
"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cl/abstract"
"github.com/ledgerwatch/erigon/cl/beacon/beaconhttp"
"github.com/ledgerwatch/erigon/cl/clparams"
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
"github.com/ledgerwatch/erigon/cl/gossip"
"github.com/ledgerwatch/erigon/cl/persistence/beacon_indicies"
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
"github.com/ledgerwatch/erigon/cl/transition"
"github.com/ledgerwatch/erigon/cl/transition/impl/eth2"
"github.com/ledgerwatch/erigon/cl/transition/machine"
"github.com/ledgerwatch/erigon/cl/utils"
"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/turbo/engineapi/engine_types"
"github.com/ledgerwatch/log/v3"
"golang.org/x/exp/slices"
=======
"golang.org/x/exp/slices"

"github.com/erigontech/erigon-lib/common"
Expand All @@ -81,7 +57,6 @@ import (
"github.com/erigontech/erigon/cl/utils"
"github.com/erigontech/erigon/core/types"
"github.com/erigontech/erigon/turbo/engineapi/engine_types"
>>>>>>> v3.0.0-alpha1
)

type BlockPublishingValidation string
Expand Down Expand Up @@ -170,8 +145,6 @@ func (a *ApiHandler) GetEthV3ValidatorBlock(
http.StatusBadRequest,
fmt.Errorf("invalid slot: %v", err),
)
<<<<<<< HEAD
=======
}

// builder boost factor controls block choice between local execution node or builder
Expand All @@ -185,7 +158,6 @@ func (a *ApiHandler) GetEthV3ValidatorBlock(
fmt.Errorf("invalid builder_boost_factor: %v", err),
)
}
>>>>>>> v3.0.0-alpha1
}

s := a.syncedData.HeadState()
Expand Down Expand Up @@ -229,55 +201,15 @@ func (a *ApiHandler) GetEthV3ValidatorBlock(
if err := transition.DefaultMachine.ProcessSlots(baseState, targetSlot); err != nil {
return nil, err
}
<<<<<<< HEAD

beaconBody, executionValue, err := a.produceBeaconBody(
ctx,
3,
sourceBlock.Block,
baseState,
targetSlot,
randaoReveal,
graffiti,
)
=======
block, err := a.produceBlock(ctx, builderBoostFactor, sourceBlock.Block, baseState, targetSlot, randaoReveal, graffiti)
>>>>>>> v3.0.0-alpha1
if err != nil {
log.Warn("Failed to produce block", "err", err, "slot", targetSlot)
return nil, err
}

<<<<<<< HEAD
proposerIndex, err := baseState.GetBeaconProposerIndex()
if err != nil {
return nil, err
}

rewardsCollector := &eth2.BlockRewardsCollector{}
block := &cltypes.BeaconBlock{
Slot: targetSlot,
ProposerIndex: proposerIndex,
ParentRoot: baseBlockRoot,
Body: beaconBody,
}
log.Info(
"BlockProduction: Computing HashSSZ block",
"slot",
targetSlot,
"execution_value",
executionValue,
"proposerIndex",
proposerIndex,
)

// compute the state root now
if err := machine.ProcessBlock(transition.DefaultMachine, baseState, &cltypes.SignedBeaconBlock{Block: block}); err != nil {
=======
// do state transition
if err := machine.ProcessBlock(transition.DefaultMachine, baseState, block.ToGeneric()); err != nil {
log.Warn("Failed to process execution block", "err", err, "slot", targetSlot)
>>>>>>> v3.0.0-alpha1
return nil, err
}
block.StateRoot, err = baseState.HashSSZ()
Expand All @@ -298,10 +230,6 @@ func (a *ApiHandler) GetEthV3ValidatorBlock(
// todo: consensusValue
rewardsCollector := &eth2.BlockRewardsCollector{}
consensusValue := rewardsCollector.Attestations + rewardsCollector.ProposerSlashings + rewardsCollector.AttesterSlashings + rewardsCollector.SyncAggregate
<<<<<<< HEAD
isSSZBlinded := false
=======
>>>>>>> v3.0.0-alpha1
a.setupHeaderReponseForBlockProduction(
w,
block.Version(),
Expand All @@ -321,8 +249,6 @@ func (a *ApiHandler) GetEthV3ValidatorBlock(
With("consensus_block_value", strconv.FormatUint(consensusValue, 10)), nil
}

<<<<<<< HEAD
=======
func (a *ApiHandler) produceBlock(
ctx context.Context,
boostFactor uint64,
Expand Down Expand Up @@ -504,7 +430,6 @@ func (a *ApiHandler) getBuilderPayload(
return header, nil
}

>>>>>>> v3.0.0-alpha1
func (a *ApiHandler) produceBeaconBody(
ctx context.Context,
apiVersion int,
Expand Down Expand Up @@ -985,14 +910,8 @@ func (a *ApiHandler) parseBlockPublishingValidation(
func (a *ApiHandler) parseRequestBeaconBlock(
version clparams.StateVersion,
r *http.Request,
<<<<<<< HEAD
) (*cltypes.SignedBeaconBlock, error) {
block := cltypes.NewSignedBeaconBlock(a.beaconChainCfg)
block.Block.Body.Version = version
=======
) (*cltypes.DenebSignedBeaconBlock, error) {
block := cltypes.NewDenebSignedBeaconBlock(a.beaconChainCfg)
>>>>>>> v3.0.0-alpha1
// check content type
switch r.Header.Get("Content-Type") {
case "application/json":
Expand Down
8 changes: 0 additions & 8 deletions cl/beacon/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,7 @@ func (a *ApiHandler) init() {
r.Get("/{block_id}", beaconhttp.HandleEndpointFunc(a.getHeader))
})
r.Route("/blocks", func(r chi.Router) {
<<<<<<< HEAD
r.Post("/", a.PostEthV1BeaconBlocks)
=======
r.Post("/", beaconhttp.HandleEndpointFunc(a.PostEthV1BeaconBlocks))
>>>>>>> v3.0.0-alpha1
r.Get("/{block_id}", beaconhttp.HandleEndpointFunc(a.GetEthV1BeaconBlock))
r.Get("/{block_id}/attestations", beaconhttp.HandleEndpointFunc(a.GetEthV1BeaconBlockAttestations))
r.Get("/{block_id}/root", beaconhttp.HandleEndpointFunc(a.GetEthV1BeaconBlockRoot))
Expand Down Expand Up @@ -328,14 +324,10 @@ func (a *ApiHandler) init() {
if a.routerCfg.Beacon {
r.Route("/beacon", func(r chi.Router) {
r.Get("/blocks/{block_id}", beaconhttp.HandleEndpointFunc(a.GetEthV1BeaconBlock))
<<<<<<< HEAD
r.Post("/blocks", a.PostEthV2BeaconBlocks)
=======
r.Post("/blocks", beaconhttp.HandleEndpointFunc(a.PostEthV2BeaconBlocks))
if a.routerCfg.Builder {
r.Post("/blinded_blocks", beaconhttp.HandleEndpointFunc(a.PostEthV2BlindedBlocks))
}
>>>>>>> v3.0.0-alpha1
})
}
if a.routerCfg.Validator {
Expand Down
5 changes: 0 additions & 5 deletions cl/beacon/handler/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ import (
"runtime"
"strconv"

<<<<<<< HEAD
"github.com/ledgerwatch/erigon-lib/gointerfaces/sentinel"
"github.com/ledgerwatch/erigon/cl/beacon/beaconhttp"
=======
sentinel "github.com/erigontech/erigon-lib/gointerfaces/sentinelproto"
"github.com/erigontech/erigon/cl/beacon/beaconhttp"
>>>>>>> v3.0.0-alpha1
)

/*
Expand Down
6 changes: 0 additions & 6 deletions cl/clparams/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,7 @@ func (b ConfigByte) MarshalJSON() ([]byte, error) {
type ConfigForkVersion uint32

func (v ConfigForkVersion) MarshalJSON() ([]byte, error) {
<<<<<<< HEAD
tmp := make([]byte, 4)
binary.BigEndian.PutUint32(tmp, uint32(v))
return []byte(fmt.Sprintf("\"0x%x\"", tmp)), nil
=======
return []byte(fmt.Sprintf("\"0x%08x\"", v)), nil
>>>>>>> v3.0.0-alpha1
}

// BeaconChainConfig contains constant configs for node to participate in beacon chain.
Expand Down
4 changes: 0 additions & 4 deletions cl/phase1/forkchoice/fork_graph/fork_graph_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ import (
"github.com/erigontech/erigon/cl/transition/impl/eth2"
)

<<<<<<< HEAD
const dumpSlotFrequency = 17
=======
const dumpSlotFrequency = 4
>>>>>>> v3.0.0-alpha1

type syncCommittees struct {
currentSyncCommittee *solid.SyncCommittee
Expand Down
41 changes: 0 additions & 41 deletions cl/sentinel/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,46 +533,6 @@ type GossipSubscription struct {
closeOnce sync.Once
}

<<<<<<< HEAD
func (sub *GossipSubscription) Listen() {
go func() {
var err error
checkingInterval := time.NewTicker(100 * time.Millisecond)
for {
select {
case <-sub.ctx.Done():
return
case <-checkingInterval.C:

expirationTime := sub.expiration.Load().(time.Time)
if sub.subscribed.Load() && time.Now().After(expirationTime) {
sub.stopCh <- struct{}{}
if cancelFunc := sub.cf; cancelFunc != nil {
cancelFunc() // stop pubsub.Subscription.Next
}
sub.topic.Close()
sub.subscribed.Store(false)
log.Info("[Gossip] Unsubscribed from topic", "topic", sub.sub.Topic())
sub.s.updateENROnSubscription(sub.sub.Topic(), false)
continue
}
if !sub.subscribed.Load() && time.Now().Before(expirationTime) {
sub.stopCh = make(chan struct{}, 3)
sub.sub, err = sub.topic.Subscribe()
if err != nil {
log.Warn("[Gossip] failed to begin topic subscription", "err", err)
time.Sleep(30 * time.Second)
continue
}
var sctx context.Context
sctx, sub.cf = context.WithCancel(sub.ctx)
go sub.run(sctx, sub.sub, sub.sub.Topic())
sub.subscribed.Store(true)
sub.s.updateENROnSubscription(sub.sub.Topic(), true)
log.Info("[Gossip] Subscribed to topic", "topic", sub.sub.Topic())
}
}
=======
func (sub *GossipSubscription) checkIfTopicNeedsToEnabledOrDisabled() {
var err error
expirationTime := sub.expiration.Load().(time.Time)
Expand All @@ -590,7 +550,6 @@ func (sub *GossipSubscription) checkIfTopicNeedsToEnabledOrDisabled() {
if err != nil {
log.Warn("[Gossip] failed to begin topic subscription", "err", err)
return
>>>>>>> v3.0.0-alpha1
}
var sctx context.Context
sctx, sub.cf = context.WithCancel(sub.ctx)
Expand Down
10 changes: 0 additions & 10 deletions cl/sentinel/service/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,13 @@ import (
"strings"
"time"

<<<<<<< HEAD
"github.com/ledgerwatch/erigon/cl/gossip"
"github.com/ledgerwatch/erigon/cl/persistence/blob_storage"
"github.com/ledgerwatch/erigon/cl/phase1/forkchoice"
"github.com/ledgerwatch/erigon/cl/sentinel"
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
"github.com/ledgerwatch/erigon/common/math"
"github.com/ledgerwatch/erigon/turbo/snapshotsync/freezeblocks"
=======
"github.com/erigontech/erigon/cl/gossip"
"github.com/erigontech/erigon/cl/persistence/blob_storage"
"github.com/erigontech/erigon/cl/phase1/forkchoice"
"github.com/erigontech/erigon/cl/sentinel"
"github.com/erigontech/erigon/cl/utils/eth_clock"
"github.com/erigontech/erigon/common/math"
"github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks"
>>>>>>> v3.0.0-alpha1

"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
Expand Down
4 changes: 0 additions & 4 deletions cl/transition/impl/eth2/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,7 @@ func (I *impl) ProcessExecutionPayload(s abstract.BeaconState, parentHash, prevR
return fmt.Errorf("ProcessExecutionPayload: invalid eth1 chain. mismatching parent")
}
}
<<<<<<< HEAD
if payload.PrevRandao != s.GetRandaoMixes(state.Epoch(s)) {
=======
if prevRandao != s.GetRandaoMixes(state.Epoch(s)) {
>>>>>>> v3.0.0-alpha1
return fmt.Errorf(
"ProcessExecutionPayload: randao mix mismatches with mix digest, expected %x, got %x",
s.GetRandaoMixes(state.Epoch(s)),
Expand Down
8 changes: 0 additions & 8 deletions merge_status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2293,14 +2293,6 @@ Unmerged paths:
both modified: Makefile
both modified: accounts/abi/bind/backends/simulated.go
both modified: accounts/abi/bind/template.go
both modified: cl/beacon/handler/block_production.go
both modified: cl/beacon/handler/handler.go
both modified: cl/beacon/handler/node.go
both modified: cl/clparams/config.go
both modified: cl/phase1/forkchoice/fork_graph/fork_graph_disk.go
both modified: cl/sentinel/gossip.go
both modified: cl/sentinel/service/start.go
both modified: cl/transition/impl/eth2/operations.go
both modified: cmd/devnet/main.go
both modified: cmd/devnet/services/polygon/proofgenerator_test.go
both modified: cmd/diag/db/db.go
Expand Down

0 comments on commit f731d1b

Please sign in to comment.