Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
domiwei committed Nov 28, 2024
1 parent 53396fd commit f46590f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cl/cltypes/beacon_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ var (

// Definition of SignedBeaconBlock
type SignedBeaconBlock struct {
Signature libcommon.Bytes96 `json:"signature"`
Block *BeaconBlock `json:"message"`
Signature libcommon.Bytes96 `json:"signature"`
}

func NewSignedBeaconBlock(beaconCfg *clparams.BeaconChainConfig, version clparams.StateVersion) *SignedBeaconBlock {
Expand Down
18 changes: 1 addition & 17 deletions cl/cltypes/solid/validator_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"io"

libcommon "github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/common/length"
"github.com/erigontech/erigon-lib/types/clonable"
"github.com/erigontech/erigon-lib/types/ssz"
"github.com/erigontech/erigon/cl/merkle_tree"
Expand Down Expand Up @@ -208,27 +207,12 @@ func (v *ValidatorSet) HashSSZ() ([32]byte, error) {
return utils.Sha256(coreRoot[:], lengthRoot[:]), nil
}

func computeFlatRootsToBuffer(depth uint8, layerBuffer, output []byte) error {
for i := uint8(0); i < depth; i++ {
// Sequential
if len(layerBuffer)%64 != 0 {
layerBuffer = append(layerBuffer, merkle_tree.ZeroHashes[i][:]...)
}
if err := merkle_tree.HashByteSlice(layerBuffer, layerBuffer); err != nil {
return err
}
layerBuffer = layerBuffer[:len(layerBuffer)/2]
}

copy(output, layerBuffer[:length.Hash])
return nil
}

func (v *ValidatorSet) Set(idx int, val Validator) {
if idx >= v.l {
panic("ValidatorSet -- Set: out of bounds")
}
copy(v.buffer[idx*validatorSize:(idx*validatorSize)+validatorSize], val)
v.zeroTreeHash(idx)
}

func (v *ValidatorSet) getPhase0(idx int) *Phase0Data {
Expand Down
2 changes: 1 addition & 1 deletion cl/phase1/core/state/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (b *CachingBeaconState) UpgradeToElectra() error {
// Update the state root cache
b.SetVersion(clparams.ElectraVersion)

earliestExitEpoch := epoch
earliestExitEpoch := ComputeActivationExitEpoch(b.BeaconConfig(), epoch)
b.ValidatorSet().Range(func(i int, v solid.Validator, _ int) bool {
if v.ExitEpoch() != b.BeaconConfig().FarFutureEpoch {
if v.ExitEpoch() > earliestExitEpoch {
Expand Down
4 changes: 2 additions & 2 deletions cl/spectest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


tests:
wget https://github.com/ethereum/consensus-spec-tests/releases/download/v1.5.0-alpha.8/mainnet.tar.gz
wget https://github.com/ethereum/consensus-spec-tests/releases/download/v1.5.0-alpha.9/mainnet.tar.gz
tar xf mainnet.tar.gz
rm mainnet.tar.gz
# not needed for now
Expand All @@ -24,4 +24,4 @@ eip7594:
CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet/eip7594/ -v --timeout 30m

deneb:
CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet/deneb/ -v --timeout 30m
CGO_CFLAGS=-D__BLST_PORTABLE__ go test -tags=spectest -run=/mainnet/deneb/ -v --timeout 30m
2 changes: 2 additions & 0 deletions cl/transition/impl/eth2/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,7 @@ func (I *impl) ProcessConsolidationRequest(s abstract.BeaconState, consolidation
// Initiate source validator exit and append pending consolidation
sourceValidator.SetExitEpoch(computeConsolidationEpochAndUpdateChurn(s, sourceValidator.EffectiveBalance()))
sourceValidator.SetWithdrawableEpoch(sourceValidator.ExitEpoch() + s.BeaconConfig().MinValidatorWithdrawabilityDelay)
s.SetValidatorAtIndex(int(sourceIndex), sourceValidator) // update the state and underlying validator set. Mark the merkle tree dirty.
s.AppendPendingConsolidation(&solid.PendingConsolidation{
SourceIndex: sourceIndex,
TargetIndex: targetIndex,
Expand Down Expand Up @@ -1268,6 +1269,7 @@ func switchToCompoundingValidator(s abstract.BeaconState, vindex uint64) error {
copy(newWc[:], wc[:])
newWc[0] = s.BeaconConfig().CompoundingWithdrawalPrefix
validator.SetWithdrawalCredentials(newWc)
s.SetValidatorAtIndex(int(vindex), validator) // update the state
return state.QueueExcessActiveBalance(s, vindex, &validator)
}

Expand Down

0 comments on commit f46590f

Please sign in to comment.