diff --git a/cl/beacon/handler/states.go b/cl/beacon/handler/states.go index 0968ebfb004..2ccb523dee3 100644 --- a/cl/beacon/handler/states.go +++ b/cl/beacon/handler/states.go @@ -510,7 +510,7 @@ func (a *ApiHandler) GetEthV1BeaconStatesPendingConsolidations(w http.ResponseWr var ok bool pendingConsolidations, ok = a.forkchoiceStore.GetPendingConsolidations(blockRoot) if !ok { - return nil, beaconhttp.NewEndpointError(http.StatusNotFound, fmt.Errorf("no pending consolidations found for block root: %x", blockRoot)) + return nil, beaconhttp.NewEndpointError(http.StatusNotFound, fmt.Errorf("no pending consolidations found for block root: %x", blockRoot)) } // If we have the pending consolidations in memory, we can return them directly. } else { @@ -522,7 +522,10 @@ func (a *ApiHandler) GetEthV1BeaconStatesPendingConsolidations(w http.ResponseWr } } + version := a.ethClock.StateVersionByEpoch(*slot / a.beaconChainCfg.SlotsPerEpoch) return newBeaconResponse(pendingConsolidations). + WithHeader("Eth-Consensus-Version", version.String()). + WithVersion(version). WithOptimistic(isOptimistic). WithFinalized(canonicalRoot == blockRoot && *slot <= a.forkchoiceStore.FinalizedSlot()), nil } @@ -569,7 +572,7 @@ func (a *ApiHandler) GetEthV1BeaconStatesPendingDeposits(w http.ResponseWriter, var ok bool pendingDeposits, ok = a.forkchoiceStore.GetPendingDeposits(blockRoot) if !ok { - return nil, beaconhttp.NewEndpointError(http.StatusNotFound, fmt.Errorf("no pending deposits found for block root: %x", blockRoot)) + return nil, beaconhttp.NewEndpointError(http.StatusNotFound, fmt.Errorf("no pending deposits found for block root: %x", blockRoot)) } } else { stateView := a.caplinStateSnapshots.View() @@ -580,7 +583,10 @@ func (a *ApiHandler) GetEthV1BeaconStatesPendingDeposits(w http.ResponseWriter, } } + version := a.ethClock.StateVersionByEpoch(*slot / a.beaconChainCfg.SlotsPerEpoch) return newBeaconResponse(pendingDeposits). + WithHeader("Eth-Consensus-Version", version.String()). + WithVersion(version). WithOptimistic(isOptimistic). WithFinalized(canonicalRoot == blockRoot && *slot <= a.forkchoiceStore.FinalizedSlot()), nil } diff --git a/cl/beacon/handler/states_test.go b/cl/beacon/handler/states_test.go index 25bf3293a75..fa6a5114276 100644 --- a/cl/beacon/handler/states_test.go +++ b/cl/beacon/handler/states_test.go @@ -554,3 +554,39 @@ func TestGetRandao(t *testing.T) { }) } } + +func TestGetPendingQueuesConsensusVersionHeader(t *testing.T) { + _, blocks, _, _, _, handler, _, _, fcu, _ := setupTestingHandler(t, clparams.ElectraVersion, log.Root(), false) + + var err error + fcu.HeadVal, err = blocks[len(blocks)-1].Block.HashSSZ() + require.NoError(t, err) + fcu.HeadSlotVal = blocks[len(blocks)-1].Block.Slot + lowest := uint64(0) + fcu.LowestAvailableSlotVal = &lowest + fcu.PendingConsolidationsVal = map[common.Hash]*solid.ListSSZ[*solid.PendingConsolidation]{ + fcu.HeadVal: solid.NewPendingConsolidationList(&clparams.MainnetBeaconConfig), + } + fcu.PendingDepositsVal = map[common.Hash]*solid.ListSSZ[*solid.PendingDeposit]{ + fcu.HeadVal: solid.NewPendingDepositList(&clparams.MainnetBeaconConfig), + } + fcu.PendingPartialWithdrawalsVal = map[common.Hash]*solid.ListSSZ[*solid.PendingPartialWithdrawal]{ + fcu.HeadVal: solid.NewPendingWithdrawalList(&clparams.MainnetBeaconConfig), + } + + server := httptest.NewServer(handler.mux) + defer server.Close() + + versions := map[string]string{} + for _, endpoint := range []string{"pending_consolidations", "pending_deposits", "pending_partial_withdrawals"} { + resp, err := http.Get(server.URL + "/eth/v1/beacon/states/head/" + endpoint) + require.NoError(t, err) + resp.Body.Close() + require.Equal(t, http.StatusOK, resp.StatusCode, endpoint) + v := resp.Header.Get("Eth-Consensus-Version") + require.NotEmpty(t, v, "%s must set Eth-Consensus-Version", endpoint) + versions[endpoint] = v + } + require.Equal(t, versions["pending_partial_withdrawals"], versions["pending_consolidations"]) + require.Equal(t, versions["pending_partial_withdrawals"], versions["pending_deposits"]) +} diff --git a/cl/cltypes/beacon_block_blinded.go b/cl/cltypes/beacon_block_blinded.go index 30071e369b7..0f6699c0806 100644 --- a/cl/cltypes/beacon_block_blinded.go +++ b/cl/cltypes/beacon_block_blinded.go @@ -276,7 +276,7 @@ func NewBlindedBeaconBody(beaconCfg *clparams.BeaconChainConfig, version clparam ExecutionChanges: solid.NewStaticListSSZ[*SignedBLSToExecutionChange](MaxExecutionChanges, 172), BlobKzgCommitments: solid.NewStaticListSSZ[*KZGCommitment](int(beaconCfg.MaxBlobCommittmentsPerBlock), 48), ExecutionRequests: executionRequests, - Version: 0, + Version: version, beaconCfg: beaconCfg, } } @@ -360,7 +360,7 @@ func (b *BlindedBeaconBody) EncodingSizeSSZ() (size int) { size += b.ExecutionChanges.EncodingSizeSSZ() } if b.Version >= clparams.DenebVersion { - size += b.ExecutionChanges.EncodingSizeSSZ() + size += b.BlobKzgCommitments.EncodingSizeSSZ() } if b.Version >= clparams.ElectraVersion { if b.ExecutionRequests != nil { diff --git a/cl/cltypes/beacon_block_blinded_test.go b/cl/cltypes/beacon_block_blinded_test.go new file mode 100644 index 00000000000..fcb55d623ee --- /dev/null +++ b/cl/cltypes/beacon_block_blinded_test.go @@ -0,0 +1,52 @@ +// Copyright 2026 The Erigon Authors +// This file is part of Erigon. +// +// Erigon is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Erigon is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Erigon. If not, see . + +package cltypes + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/erigontech/erigon/cl/clparams" +) + +// EncodingSizeSSZ must grow by exactly the encoded delta when a field's +// content grows, for every field gated by a fork version. +func TestBlindedBeaconBodyEncodingSizeTracksEncoding(t *testing.T) { + for _, v := range []clparams.StateVersion{clparams.DenebVersion, clparams.ElectraVersion} { + t.Run(v.String(), func(t *testing.T) { + body := NewBlindedBeaconBody(&clparams.MainnetBeaconConfig, v) + require.Equal(t, v, body.Version, "constructor must honor the version argument") + + enc0, err := body.EncodeSSZ(nil) + require.NoError(t, err) + size0 := body.EncodingSizeSSZ() + + body.BlobKzgCommitments.Append(&KZGCommitment{}) + enc1, err := body.EncodeSSZ(nil) + require.NoError(t, err) + size1 := body.EncodingSizeSSZ() + require.Equal(t, len(enc1)-len(enc0), size1-size0, "BlobKzgCommitments not reflected in EncodingSizeSSZ") + + body.ExecutionChanges.Append(&SignedBLSToExecutionChange{Message: &BLSToExecutionChange{}}) + enc2, err := body.EncodeSSZ(nil) + require.NoError(t, err) + size2 := body.EncodingSizeSSZ() + require.Equal(t, len(enc2)-len(enc1), size2-size1, "ExecutionChanges over-counted in EncodingSizeSSZ") + }) + } +} diff --git a/cl/phase1/forkchoice/mock_services/forkchoice_mock.go b/cl/phase1/forkchoice/mock_services/forkchoice_mock.go index f9415ed4ea4..e065c72e584 100644 --- a/cl/phase1/forkchoice/mock_services/forkchoice_mock.go +++ b/cl/phase1/forkchoice/mock_services/forkchoice_mock.go @@ -58,21 +58,24 @@ type ForkChoiceStorageMock struct { ParticipationVal map[uint64]*solid.ParticipationBitList - StateAtBlockRootVal map[common.Hash]*state.CachingBeaconState - StateAtSlotVal map[uint64]*state.CachingBeaconState - GetSyncCommitteesVal map[uint64][2]*solid.SyncCommittee - GetFinalityCheckpointsVal map[common.Hash][3]solid.Checkpoint - WeightsMock []forkchoice.ForkNode - LightClientBootstraps map[common.Hash]*cltypes.LightClientBootstrap - NewestLCUpdate *cltypes.LightClientUpdate - LCUpdates map[uint64]*cltypes.LightClientUpdate - SyncContributionPool sync_contribution_pool.SyncContributionPool - Headers map[common.Hash]*cltypes.BeaconBlockHeader - Blocks map[common.Hash]*cltypes.SignedBeaconBlock - Envelopes map[common.Hash]*cltypes.SignedExecutionPayloadEnvelope - VerifiedPayloads map[common.Hash]bool - OnExecutionPayloadErr error - GetBeaconCommitteeMock func(slot, committeeIndex uint64) ([]uint64, error) + StateAtBlockRootVal map[common.Hash]*state.CachingBeaconState + StateAtSlotVal map[uint64]*state.CachingBeaconState + GetSyncCommitteesVal map[uint64][2]*solid.SyncCommittee + GetFinalityCheckpointsVal map[common.Hash][3]solid.Checkpoint + PendingConsolidationsVal map[common.Hash]*solid.ListSSZ[*solid.PendingConsolidation] + PendingDepositsVal map[common.Hash]*solid.ListSSZ[*solid.PendingDeposit] + PendingPartialWithdrawalsVal map[common.Hash]*solid.ListSSZ[*solid.PendingPartialWithdrawal] + WeightsMock []forkchoice.ForkNode + LightClientBootstraps map[common.Hash]*cltypes.LightClientBootstrap + NewestLCUpdate *cltypes.LightClientUpdate + LCUpdates map[uint64]*cltypes.LightClientUpdate + SyncContributionPool sync_contribution_pool.SyncContributionPool + Headers map[common.Hash]*cltypes.BeaconBlockHeader + Blocks map[common.Hash]*cltypes.SignedBeaconBlock + Envelopes map[common.Hash]*cltypes.SignedExecutionPayloadEnvelope + VerifiedPayloads map[common.Hash]bool + OnExecutionPayloadErr error + GetBeaconCommitteeMock func(slot, committeeIndex uint64) ([]uint64, error) Pool pool.OperationsPool @@ -523,15 +526,18 @@ func (f *ForkChoiceStorageMock) IsHeadOptimistic() bool { } func (f *ForkChoiceStorageMock) GetPendingConsolidations(blockRoot common.Hash) (*solid.ListSSZ[*solid.PendingConsolidation], bool) { - return nil, false + v, ok := f.PendingConsolidationsVal[blockRoot] + return v, ok } func (f *ForkChoiceStorageMock) GetPendingDeposits(blockRoot common.Hash) (*solid.ListSSZ[*solid.PendingDeposit], bool) { - return nil, false + v, ok := f.PendingDepositsVal[blockRoot] + return v, ok } func (f *ForkChoiceStorageMock) GetPendingPartialWithdrawals(blockRoot common.Hash) (*solid.ListSSZ[*solid.PendingPartialWithdrawal], bool) { - return nil, false + v, ok := f.PendingPartialWithdrawalsVal[blockRoot] + return v, ok } func (f *ForkChoiceStorageMock) GetProposerLookahead(slot uint64) (solid.Uint64VectorSSZ, bool) { diff --git a/cmd/txpool/main.go b/cmd/txpool/main.go index af94130d973..148cd4c77e4 100644 --- a/cmd/txpool/main.go +++ b/cmd/txpool/main.go @@ -113,7 +113,7 @@ var rootCmd = &cobra.Command{ debug.Exit() }, Run: func(cmd *cobra.Command, args []string) { - logger := debug.SetupCobra(cmd, "integration") + logger := debug.SetupCobra(cmd, "txpool") if err := doTxpool(cmd.Context(), logger); err != nil { if !errors.Is(err, context.Canceled) { log.Error(err.Error()) diff --git a/db/kv/mdbx/kv_mdbx.go b/db/kv/mdbx/kv_mdbx.go index c0808c7eeb7..35ca589967f 100644 --- a/db/kv/mdbx/kv_mdbx.go +++ b/db/kv/mdbx/kv_mdbx.go @@ -1591,7 +1591,7 @@ func (c *MdbxCursorPseudoDupSort) LastDup() ([]byte, error) { if mdbx.IsNotFound(err) { return nil, nil } - return nil, fmt.Errorf("in FirstDup: tbl=%s, %w", c.bucketName, err) + return nil, fmt.Errorf("in LastDup: tbl=%s, %w", c.bucketName, err) } return v, nil } diff --git a/db/snapshotsync/freezeblocks/block_snapshots.go b/db/snapshotsync/freezeblocks/block_snapshots.go index b73405113c8..e3ea0bc851f 100644 --- a/db/snapshotsync/freezeblocks/block_snapshots.go +++ b/db/snapshotsync/freezeblocks/block_snapshots.go @@ -93,37 +93,6 @@ func NewRoSnapshots(cfg ethconfig.BlocksFreezing, snapDir string, logger log.Log // transaction_hash -> transactions_segment_offset // transaction_hash -> block_number -func SegmentsCaplin(dir string, minBlock uint64) (res []snaptype.FileInfo, missingSnapshots []snapshotsync.Range, err error) { - list, err := snaptype.Segments(dir) - if err != nil { - return nil, missingSnapshots, err - } - - { - var l, lSidecars []snaptype.FileInfo - var m []snapshotsync.Range - for _, f := range list { - if f.Type.Enum() != snaptype.CaplinEnums.BeaconBlocks && f.Type.Enum() != snaptype.CaplinEnums.BlobSidecars { - continue - } - if f.Type.Enum() == snaptype.CaplinEnums.BlobSidecars { - lSidecars = append(lSidecars, f) // blobs are an exception - continue - } - l = append(l, f) - } - l, m = snapshotsync.NoGaps(snapshotsync.NoOverlaps(l)) - if len(m) > 0 { - lst := m[len(m)-1] - log.Debug("[snapshots] see gap", "type", snaptype.CaplinEnums.BeaconBlocks, "from", lst.From()) - } - res = append(res, l...) - res = append(res, lSidecars...) - missingSnapshots = append(missingSnapshots, m...) - } - return res, missingSnapshots, nil -} - func chooseSegmentEnd(from, to uint64, snapType snaptype.Enum, snCfg *snapcfg.Cfg) uint64 { blocksPerFile := snapcfg.MergeLimitFromCfg(snCfg, snapType, from) diff --git a/db/state/integrity.go b/db/state/integrity.go index 02e30ac31a3..e51698f01db 100644 --- a/db/state/integrity.go +++ b/db/state/integrity.go @@ -43,12 +43,12 @@ func (at *AggregatorRoTx) IntegrityInvertedIndexAllValuesAreInRange(ctx context. return err } case kv.StorageHistoryIdx: - err := at.d[kv.CodeDomain].ht.iit.IntegrityInvertedIndexAllValuesAreInRange(ctx, failFast, fromStep) + err := at.d[kv.StorageDomain].ht.iit.IntegrityInvertedIndexAllValuesAreInRange(ctx, failFast, fromStep) if err != nil { return err } case kv.CodeHistoryIdx: - err := at.d[kv.StorageDomain].ht.iit.IntegrityInvertedIndexAllValuesAreInRange(ctx, failFast, fromStep) + err := at.d[kv.CodeDomain].ht.iit.IntegrityInvertedIndexAllValuesAreInRange(ctx, failFast, fromStep) if err != nil { return err } diff --git a/execution/exec/txtask.go b/execution/exec/txtask.go index f7d505bd057..c536945dc2e 100644 --- a/execution/exec/txtask.go +++ b/execution/exec/txtask.go @@ -673,7 +673,7 @@ func (txTask *TxTask) executeAA(aaTxn *types.AccountAbstractionTransaction, result.Err = outerErr return &result } - log.Info("✅[aa] validated AA bundle", "len", startIdx-endIdx) + log.Info("✅[aa] validated AA bundle", "len", endIdx-startIdx+1) result.ValidationResults = validationResults } diff --git a/execution/stagedsync/exec3_metrics.go b/execution/stagedsync/exec3_metrics.go index eabdaee0e61..09b0fe81c28 100644 --- a/execution/stagedsync/exec3_metrics.go +++ b/execution/stagedsync/exec3_metrics.go @@ -73,7 +73,7 @@ var ( mxExecStorageDomainReads = metrics.NewGauge(`exec_domain_read_rate{domain="storage"}`) mxExecStorageDomainReadDuration = metrics.NewGauge(`exec_domain_read_dur{domain="storage"}`) - mxExexStorageDomainCacheReads = metrics.NewGauge(`exec_domain_cache_read_rate{domain="storage"}`) + mxExecStorageDomainCacheReads = metrics.NewGauge(`exec_domain_cache_read_rate{domain="storage"}`) mxExecStorageDomainCacheReadDuration = metrics.NewGauge(`exec_domain_cache_read_dur{domain="storage"}`) mxExecStorageDomainPutRate = metrics.NewGauge(`exec_domain_cache_put_rate{domain="storage"}`) mxExecStorageDomainPutSize = metrics.NewGauge(`exec_domain_cache_put_size{domain="storage"}`) @@ -86,7 +86,7 @@ var ( mxExecCodeDomainReads = metrics.NewGauge(`exec_domain_read_rate{domain="code"}`) mxExecCodeDomainReadDuration = metrics.NewGauge(`exec_domain_read_dur{domain="code"}`) - mxExexCodeDomainCacheReads = metrics.NewGauge(`exec_domain_cache_read_rate{domain="code"}`) + mxExecCodeDomainCacheReads = metrics.NewGauge(`exec_domain_cache_read_rate{domain="code"}`) mxExecCodeDomainCacheReadDuration = metrics.NewGauge(`exec_domain_cache_read_dur{domain="code"}`) mxExecCodeDomainPutRate = metrics.NewGauge(`exec_domain_cache_put_rate{domain="code"}`) mxExecCodeDomainPutSize = metrics.NewGauge(`exec_domain_cache_put_size{domain="code"}`) @@ -104,7 +104,7 @@ var ( mxCommitmentAccountReadRate = metrics.NewGauge("commit_account_read_rate") mxCommitmentStorageReadRate = metrics.NewGauge("commit_storage_read_rate") mxCommitmentBranchReadRate = metrics.NewGauge("commit_branch_read_rate") - mxCommitmentBrancgWriteRate = metrics.NewGauge("commit_branch_write_rate") + mxCommitmentBranchWriteRate = metrics.NewGauge("commit_branch_write_rate") mxCommitmentKeyRate = metrics.NewGauge("commit_key_rate") mxCommitmentAccountKeyRate = metrics.NewGauge("commit_account_key_rate") mxCommitmentStorageKeyRate = metrics.NewGauge("commit_storage_key_rate") @@ -232,15 +232,15 @@ func resetDomainGauges(ctx context.Context) { mxExecDomainFileReads, mxExecDomainFileReadDuration, mxExecAccountDomainReads, mxExecAccountDomainReadDuration, mxExecAccountDomainCacheReads, mxExecAccountDomainCacheReadDuration, mxExecAccountDomainDbReads, mxExecAccountDomainDbReadDuration, mxExecAccountDomainFileReads, mxExecAccountDomainFileReadDuration, mxExecStorageDomainReads, mxExecStorageDomainReadDuration, - mxExexStorageDomainCacheReads, mxExecStorageDomainCacheReadDuration, mxExecStorageDomainDbReads, mxExecStorageDomainDbReadDuration, + mxExecStorageDomainCacheReads, mxExecStorageDomainCacheReadDuration, mxExecStorageDomainDbReads, mxExecStorageDomainDbReadDuration, mxExecStorageDomainFileReads, mxExecStorageDomainFileReadDuration, mxExecCodeDomainReads, mxExecCodeDomainReadDuration, - mxExexCodeDomainCacheReads, mxExecCodeDomainCacheReadDuration, mxExecCodeDomainDbReads, mxExecCodeDomainDbReadDuration, + mxExecCodeDomainCacheReads, mxExecCodeDomainCacheReadDuration, mxExecCodeDomainDbReads, mxExecCodeDomainDbReadDuration, mxExecCodeDomainFileReads, mxExecCodeDomainFileReadDuration, mxExecDomainPutRate, mxExecDomainPutSize, mxExecDomainPutKeySize, mxExecDomainPutValueSize, mxExecAccountDomainPutRate, mxExecAccountDomainPutSize, mxExecAccountDomainPutKeySize, mxExecAccountDomainPutValueSize, mxExecStorageDomainPutRate, mxExecStorageDomainPutSize, mxExecStorageDomainPutKeySize, mxExecStorageDomainPutValueSize, mxExecCodeDomainPutRate, mxExecCodeDomainPutSize, mxExecCodeDomainPutKeySize, mxExecCodeDomainPutValueSize, mxCommitmentReadRate, mxCommitmentAccountReadRate, - mxCommitmentStorageReadRate, mxCommitmentBranchReadRate, mxCommitmentBrancgWriteRate, mxCommitmentKeyRate, + mxCommitmentStorageReadRate, mxCommitmentBranchReadRate, mxCommitmentBranchWriteRate, mxCommitmentKeyRate, mxCommitmentAccountKeyRate, mxCommitmentStorageKeyRate, mxCommitmentFoldRate, mxCommitmentUnfoldRate, mxCommitmentDomainReads, mxCommitmentDomainReadDuration, mxCommitmentDomainCacheReads, mxCommitmentDomainCacheReadDuration, mxCommitmentDomainDbReads, mxCommitmentDomainDbReadDuration, mxCommitmentDomainFileReads, mxCommitmentDomainFileReadDuration, mxCommitmentDomainPutRate, @@ -312,7 +312,7 @@ func updateExecDomainMetrics(metrics *kvmetrics.DomainMetrics, prevMetrics *kvme mxExecAccountDomainCacheReads.Set(float64(cacheReads) / seconds) mxExecAccountDomainCacheReadDuration.Set(float64(cacheDuration) / float64(cacheReads)) if executing { - mxExecAccountDomainPutRate.Set(float64(cachePutCount)) + mxExecAccountDomainPutRate.Set(float64(cachePutCount) / seconds) mxExecAccountDomainPutSize.Set(float64(cachePutSize)) mxExecAccountDomainPutKeySize.Set(float64(cachePutKeySize)) mxExecAccountDomainPutValueSize.Set(float64(cachePutValueSize)) @@ -346,10 +346,10 @@ func updateExecDomainMetrics(metrics *kvmetrics.DomainMetrics, prevMetrics *kvme mxExecStorageDomainReads.Set(float64(cacheReads+dbReads+fileReads) / seconds) mxExecStorageDomainReadDuration.Set(float64(cacheDuration+dbDuration+fileDuration) / float64(cacheReads+dbReads+fileReads)) - mxExexStorageDomainCacheReads.Set(float64(cacheReads) / seconds) + mxExecStorageDomainCacheReads.Set(float64(cacheReads) / seconds) mxExecStorageDomainCacheReadDuration.Set(float64(cacheDuration) / float64(cacheReads)) if executing { - mxExecStorageDomainPutRate.Set(float64(cachePutCount)) + mxExecStorageDomainPutRate.Set(float64(cachePutCount) / seconds) mxExecStorageDomainPutSize.Set(float64(cachePutSize)) mxExecStorageDomainPutKeySize.Set(float64(cachePutKeySize)) mxExecStorageDomainPutValueSize.Set(float64(cachePutValueSize)) @@ -383,9 +383,9 @@ func updateExecDomainMetrics(metrics *kvmetrics.DomainMetrics, prevMetrics *kvme mxExecCodeDomainReads.Set(float64(cacheReads+dbReads+fileReads) / seconds) mxExecCodeDomainReadDuration.Set(float64(cacheDuration+dbDuration+fileDuration) / float64(cacheReads+dbReads+fileReads)) - mxExexCodeDomainCacheReads.Set(float64(cacheReads) / seconds) + mxExecCodeDomainCacheReads.Set(float64(cacheReads) / seconds) mxExecCodeDomainCacheReadDuration.Set(float64(cacheDuration) / float64(cacheReads)) - mxExecCodeDomainPutRate.Set(float64(cachePutCount)) + mxExecCodeDomainPutRate.Set(float64(cachePutCount) / seconds) mxExecCodeDomainPutSize.Set(float64(cachePutSize)) mxExecCodeDomainPutKeySize.Set(float64(cachePutKeySize)) mxExecCodeDomainPutValueSize.Set(float64(cachePutValueSize)) @@ -420,7 +420,7 @@ func updateExecDomainMetrics(metrics *kvmetrics.DomainMetrics, prevMetrics *kvme mxCommitmentDomainReadDuration.Set(float64(cacheDuration+dbDuration+fileDuration) / float64(cacheReads+dbReads+fileReads)) mxCommitmentDomainCacheReads.Set(float64(cacheReads) / seconds) mxCommitmentDomainCacheReadDuration.Set(float64(cacheDuration) / float64(cacheReads)) - mxCommitmentDomainPutRate.Set(float64(cachePutCount)) + mxCommitmentDomainPutRate.Set(float64(cachePutCount) / seconds) mxCommitmentDomainPutSize.Set(float64(cachePutSize)) mxCommitmentDomainPutKeySize.Set(float64(cachePutKeySize)) mxCommitmentDomainPutValueSize.Set(float64(cachePutValueSize)) @@ -791,7 +791,7 @@ func (p *Progress) LogCommitments(rs *state.StateV3, ex executor, stepsInDb floa mxCommitmentAccountReadRate.Set(float64(curAccountReadCount) / interval.Seconds()) mxCommitmentStorageReadRate.Set(float64(curStorageReadCount) / interval.Seconds()) mxCommitmentBranchReadRate.Set(float64(curBranchReadCount) / interval.Seconds()) - mxCommitmentBrancgWriteRate.SetUint64(curBranchWriteRate) + mxCommitmentBranchWriteRate.SetUint64(curBranchWriteRate) mxCommitmentTransactions.Set(float64(committedTxSec)) mxCommitmentBlocks.Set(float64(committedDiffBlocks)) diff --git a/execution/stagedsync/exec3_serial.go b/execution/stagedsync/exec3_serial.go index 0e8891f4dca..a1bc7d0805d 100644 --- a/execution/stagedsync/exec3_serial.go +++ b/execution/stagedsync/exec3_serial.go @@ -268,12 +268,8 @@ func (se *serialExecutor) exec(ctx context.Context, execStage *StageState, u Unw lastExecutedStep := kv.Step(uint64(se.lastExecutedTxNum.Load()) / se.doms.StepSize()) - // if we're in the initialCycle before we consider the blockLimit we need to make sure we keep executing - // until we reach a transaction whose comittement which is writable to the db, otherwise the update will get lost - if !initialCycle || lastExecutedStep > 0 && lastExecutedStep > lastFrozenStep && !dbg.DiscardCommitment() { - if blockLimit > 0 && blockNum-startBlockNum+1 >= blockLimit && blockNum != maxBlockNum { - return b.HeaderNoCopy(), rwTx, &ErrLoopExhausted{From: startBlockNum, To: blockNum, Reason: "block limit reached"} - } + if shouldMarkExhaustedAtBlock(initialCycle, lastExecutedStep, lastFrozenStep, dbg.DiscardCommitment(), blockLimit, blockNum, startBlockNum, maxBlockNum) { + return b.HeaderNoCopy(), rwTx, &ErrLoopExhausted{From: startBlockNum, To: blockNum, Reason: "block limit reached"} } } se.doms.PrintCacheStats() diff --git a/p2p/sentry/sentry_multi_client/sentry_multi_client.go b/p2p/sentry/sentry_multi_client/sentry_multi_client.go index 963f49a0b8c..a90b7e74138 100644 --- a/p2p/sentry/sentry_multi_client/sentry_multi_client.go +++ b/p2p/sentry/sentry_multi_client/sentry_multi_client.go @@ -250,8 +250,8 @@ func (cs *MultiClient) getBlockHeaders66(ctx context.Context, inreq *sentryproto } _, err = sentry.SendMessageById(ctx, &outreq, &grpc.EmptyCallOption{}) if err != nil { - if !libsentry.IsPeerNotFoundErr(err) { - return fmt.Errorf("send header response 66: %w", err) + if libsentry.IsPeerNotFoundErr(err) { + return nil } return fmt.Errorf("send header response 66: %w", err) }