Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erigon3 upstream e4eb9fc #483

Merged
merged 91 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
9605979
Updgopsutilversion (#11507)
dvovk Aug 7, 2024
f1621bc
Use inlinable version of murmur3 (#11510)
AskAlexSharov Aug 7, 2024
d919ab7
mdbx: remove unused table names and keys (#11506)
battlmonstr Aug 7, 2024
df04b78
astrid: optimise and tidy up synchronisation points (#11504)
taratorio Aug 7, 2024
80c929f
Commitment code cleanup (#11517)
awskii Aug 8, 2024
abaca33
add pretty printer for k/M/B/T/Quintillion counters printing (#11515)
awskii Aug 8, 2024
99f6731
qa-tests: update test scheduling and timeouts (#11514)
mriccobene Aug 8, 2024
50c9a92
Block: use generic atomics (#11512)
AskAlexSharov Aug 8, 2024
de47042
diagnostics: processes (#11516)
dvovk Aug 8, 2024
0d99274
pool: add more err context (#11521)
AskAlexSharov Aug 8, 2024
dd2d76d
up x deps (#11511)
AskAlexSharov Aug 8, 2024
c60d185
polygon/heimdall: add service tests (#11426)
taratorio Aug 8, 2024
7d9c3d6
diagnostics: added cpu and memory usage details (#11526)
dvovk Aug 8, 2024
0c44534
Use `PrettyCounter` (#11525)
awskii Aug 8, 2024
9443d88
`Commitment`: remove keys from `Update` (#11528)
awskii Aug 8, 2024
b72568a
reduce prune deadline on chain-tip (#11529)
AskAlexSharov Aug 8, 2024
90c9339
polygon/heimdall: silence service tests logging (#11534)
taratorio Aug 8, 2024
1e775d6
diagnostics: refactored table utils (#11537)
dvovk Aug 9, 2024
1f95904
Erigon: Added verification for whether snapshots are publishable or n…
Giulio2002 Aug 9, 2024
26d3258
astrid: make sync stage tx action channel bufferred (#11535)
taratorio Aug 9, 2024
391fc4b
don't use lfs for consensus spec tests (#11545)
yperbasis Aug 9, 2024
a3433cc
polygon: add unwind prune to sync stage (#11531)
taratorio Aug 9, 2024
119ec1f
diagnostics: refactored cpu info (#11544)
dvovk Aug 9, 2024
2a98f6a
stagedsync: add dbg.SaveHeapProfileNearOOM to headers stage (#11549)
taratorio Aug 9, 2024
ff2130d
Move visual inside cmd/pics (#11543)
yperbasis Aug 9, 2024
5b30f2e
JumpDest: evm-based LRU cache (#11524)
AskAlexSharov Aug 9, 2024
b0a2654
diagnostics: added flags to report (#11548)
dvovk Aug 9, 2024
af4dc9d
E3: Remove Proof-Of-Work Consensus code (#11556)
Giulio2002 Aug 10, 2024
da2f260
engineapi: Send status SYNCING for fcu when busy (#11491)
somnathb1 Aug 11, 2024
647a72f
more cl state events (#11527)
domiwei Aug 11, 2024
1f24de6
Caplin: Fixed flag usage (#11564)
Giulio2002 Aug 12, 2024
49e443c
Caplin: Make sure frozenBlocks >= frozenBlobs (#11558)
Giulio2002 Aug 12, 2024
25da9ed
polygon/sync: Fix `onMilestoneEvent` crash (#11568)
shohamc1 Aug 12, 2024
5a1c4a3
fix concurrent rw on touchedLeaves map (#11566)
domiwei Aug 12, 2024
bf38839
dbg: add save heap options for logger and memstats inputs (#11575)
taratorio Aug 12, 2024
3474232
Ottersync: Publishable checks - Added interval checks and fixed sepol…
Giulio2002 Aug 12, 2024
a484e35
FIx txpool readme (#11573)
shashiyy Aug 13, 2024
17a595f
chain-tip perf: share worker between execs (#11542)
AskAlexSharov Aug 13, 2024
8991773
Add mgas log (#11571)
mh0lt Aug 13, 2024
e6cda71
Torrent close and progress reporting fixes (#11532)
mh0lt Aug 13, 2024
043b258
go 1.21 (#11582)
AskAlexSharov Aug 13, 2024
9e357e2
polygon/sync: Use store at tip (#11579)
shohamc1 Aug 13, 2024
12a286d
remove useless code in beaconStateHasher (#11587)
domiwei Aug 13, 2024
a9e2275
bt: use madv_normal instead madv_readahead for index opening (#11584)
AskAlexSharov Aug 13, 2024
750105f
exec: use dedicated worker for mining (#11586)
AskAlexSharov Aug 13, 2024
f47b02b
diagnostics: added api to get sys info data (#11589)
dvovk Aug 13, 2024
959bc37
Simplify `StateReaderV3` by extracting `StateReaderParallelV3` (#11581)
AskAlexSharov Aug 13, 2024
d598a58
E3: Added ability to download index files and accessors (#11594)
Giulio2002 Aug 14, 2024
cfe8353
prune less blocks on chain-tip (#11593)
AskAlexSharov Aug 14, 2024
593abd4
inverted index: lru (#11530)
AskAlexSharov Aug 14, 2024
12d7e76
Replace `ReaderV4` by `ReaderV3` (#11600)
AskAlexSharov Aug 14, 2024
e9b7e7e
fix incorrect return type for `eth_egtProof` (#11605)
temaniarpit27 Aug 14, 2024
f4322d9
Move atomic hash from Block to Header (#11513)
AskAlexSharov Aug 14, 2024
2582631
Enable LessFalsePositives feature for header.idx (#11598)
AskAlexSharov Aug 14, 2024
00d6fdc
move p2p genReceipts behind experimental env flag (#11604)
AskAlexSharov Aug 14, 2024
92e426c
polygon/bridge: Support read-only operations (#11565)
shohamc1 Aug 14, 2024
2f2fa91
astrid: integrate bridge in polygon_sync_stage mode (#11606)
taratorio Aug 14, 2024
487a369
Merge MiningResultPOSCh with MiningResultCh (#11612)
yperbasis Aug 14, 2024
b985c16
polygon/bor: remove unused params in NewRo (#11611)
taratorio Aug 14, 2024
82ba662
Added hooks to ProcessFrozenBlocks (#11610)
JkLondon Aug 14, 2024
a264b9f
Delete AuRa GenerateSeal (#11616)
yperbasis Aug 14, 2024
9e323b8
Cleanup torrents of indexing files (#11596)
Giulio2002 Aug 14, 2024
2a08e0d
Bump up erigon-snapshots (#11621)
Giulio2002 Aug 14, 2024
c31eb64
fix panic issue in initializeStateAntiquaryIfNeeded (#11608)
domiwei Aug 15, 2024
8a28557
Ottersync: make --all flag to seed .idx, .vi, etc... (#11540)
Giulio2002 Aug 15, 2024
9889b11
Fixed race into E3 salt-blocks.txt (#11622)
Giulio2002 Aug 15, 2024
c9cefa4
db: pagesize default change to 4kb (#11602)
AskAlexSharov Aug 15, 2024
4772138
polygon/bor: simplify state receiver contract code (#11618)
taratorio Aug 15, 2024
cdc5395
adds kurtosis-assertoor to ci (#11464)
sudeepdino008 Aug 15, 2024
23ae58a
polygon/bor: add borabi pkg (#11619)
taratorio Aug 15, 2024
ef233ed
polygon/heimdall: introduce event.Marshall/Unmarshall funcs to hide a…
taratorio Aug 15, 2024
c746942
Revert "E3: Remove Proof-Of-Work Consensus code" (#11628)
yperbasis Aug 15, 2024
dfa0625
stagedsync: fix astrid sync stage panic due to unintentionally commit…
taratorio Aug 15, 2024
41465d5
polygon/sync: naming follow up (#11630)
taratorio Aug 15, 2024
f6a39a5
Add custom chain support to Caplin (#11508)
Giulio2002 Aug 15, 2024
4b5373e
print lru stats after exec stage (#11601)
AskAlexSharov Aug 15, 2024
6b8c6eb
E3: Added accessor snaptype (#11632)
Giulio2002 Aug 16, 2024
f1e8643
diagnostics: fix setup (#11633)
dvovk Aug 16, 2024
a883ad9
codeBitmap: isPush trick (#11597)
AskAlexSharov Aug 16, 2024
c28c0aa
more conservative blocks prune (#11614)
AskAlexSharov Aug 16, 2024
5827b0b
Prune still affecting chain-tip "fsync" (#11637)
AskAlexSharov Aug 16, 2024
4c0183e
`lru` which covers all .kv files - but belongs to `aggTx` (#11489)
AskAlexSharov Aug 16, 2024
820abe5
diagnostics: added func to grab heap profile (#11643)
dvovk Aug 16, 2024
3cb847b
lru: disable default tracing (#11651)
AskAlexSharov Aug 17, 2024
6c387bf
qa-tests: save erigon logs for future inspections (#11654)
mriccobene Aug 17, 2024
c78450c
Erigon 3: Prune canonical markers - `CanonicalHash`, `HeaderNumber` f…
Giulio2002 Aug 18, 2024
12ebd14
e3: bind ii/domain lru to `_visibleFiles` object (#11652)
AskAlexSharov Aug 18, 2024
48544c9
ibs: remove blockhash (#11656)
AskAlexSharov Aug 19, 2024
e4eb9fc
Borevent snapshot validation (#9436)
mh0lt Aug 19, 2024
47082da
Merge remote-tracking branch 'ledgerwatch/main' into erigon3_upstream…
blxdyx Aug 19, 2024
55e9435
upstream erigon3
blxdyx Aug 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 35 additions & 0 deletions .github/workflows/kurtosis/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
participants_matrix:
el:
- el_type: geth
- el_type: erigon
el_image: <<ERIGON_IMAGE_PLACEHOLDER>>
cl:
- cl_type: lighthouse
- cl_type: teku
network_params:
electra_fork_epoch: 1
min_validator_withdrawability_delay: 1
shard_committee_period: 1
additional_services:
- dora
- apache
- assertoor
snooper_enabled: true
assertoor_params:
run_stability_check: false
run_block_proposal_check: false
tests:
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/all-opcodes-test.yaml
#- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/blob-transactions-test.yaml
#- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/dencun-opcodes-test.yaml
#- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/eoa-transactions-test.yaml
#- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/stability-check.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/synchronized-check.yaml
#- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-exit-test.yaml
# - https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-lifecycle-test-v2.yaml
# - https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-lifecycle-test.yaml
# - https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-proposer-slashing-test.yaml
# - https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-withdrawal-test.yaml
# - https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-withdrawal-test-v2.yaml
# - https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-slashing-test.yaml
# - https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/block-proposal-check.yaml
28 changes: 15 additions & 13 deletions .github/workflows/qa-snap-download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: QA - Snapshot Download

on:
schedule:
- cron: '0 5 * * 1-6' # Run every day at 05:00 AM UTC except Sunday
- cron: '0 0 * * 1-6' # Run every night at 00:00 AM UTC except Sunday
workflow_dispatch: # Run manually

jobs:
snap-download-test:
runs-on: self-hosted
timeout-minutes: 800
timeout-minutes: 500
env:
ERIGON_DATA_DIR: ${{ github.workspace }}/erigon_data
ERIGON_QA_PATH: /home/qarunner/erigon-qa
TOTAL_TIME_SECONDS: 43200 # 12 hours
TOTAL_TIME_SECONDS: 28800 # 8 hours
CHAIN: mainnet

steps:
Expand Down Expand Up @@ -64,15 +64,6 @@ jobs:
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
fi

- name: Clean up Erigon data directory
if: always()
run: |
rm -rf $ERIGON_DATA_DIR

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Save test results
if: steps.test_step.outputs.test_executed == 'true'
env:
Expand All @@ -93,7 +84,18 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{ github.workspace }}/result-${{ env.CHAIN }}.json
path: |
${{ github.workspace }}/result-${{ env.CHAIN }}.json
${{ github.workspace }}/erigon_data/logs/erigon.log

- name: Clean up Erigon data directory
if: always()
run: |
rm -rf $ERIGON_DATA_DIR

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Action for Success
if: steps.test_step.outputs.TEST_RESULT == 'success'
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/qa-sync-from-scratch-minimal-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ name: QA - Sync from scratch (minimal node)

on:
schedule:
- cron: '0 0 * * 6' # Run on Saturday at 00:00 AM UTC
- cron: '0 0 * * *' # Run every night at 00:00 AM UTC
workflow_dispatch: # Run manually

jobs:
minimal-node-sync-from-scratch-test:
runs-on: self-hosted
timeout-minutes: 1500 # 25 hours
timeout-minutes: 360 # 6 hours
env:
ERIGON_DATA_DIR: ${{ github.workspace }}/erigon_data
ERIGON_QA_PATH: /home/qarunner/erigon-qa
TRACKING_TIME_SECONDS: 7200 # 2 hours
TOTAL_TIME_SECONDS: 86400 # 24 hours
TOTAL_TIME_SECONDS: 18000 # 5 hours
CHAIN: mainnet

steps:
Expand Down Expand Up @@ -65,15 +65,6 @@ jobs:
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
fi

- name: Clean up Erigon data directory
if: always()
run: |
rm -rf $ERIGON_DATA_DIR

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Save test results
if: steps.test_step.outputs.test_executed == 'true'
env:
Expand All @@ -94,7 +85,18 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{ github.workspace }}/result-${{ env.CHAIN }}.json
path: |
${{ github.workspace }}/result-${{ env.CHAIN }}.json
${{ github.workspace }}/erigon_data/logs/erigon.log

- name: Clean up Erigon data directory
if: always()
run: |
rm -rf $ERIGON_DATA_DIR

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Action for Success
if: steps.test_step.outputs.TEST_RESULT == 'success'
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/qa-sync-from-scratch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
sync-from-scratch-test:
runs-on: self-hosted
timeout-minutes: 1100 # 18 hours plus 20 minutes
timeout-minutes: 740 # 12 hours plus 20 minutes
strategy:
fail-fast: false
matrix:
Expand All @@ -17,7 +17,7 @@ jobs:
ERIGON_DATA_DIR: ${{ github.workspace }}/erigon_data
ERIGON_QA_PATH: /home/qarunner/erigon-qa
TRACKING_TIME_SECONDS: 7200 # 2 hours
TOTAL_TIME_SECONDS: 57600 # 16 hours
TOTAL_TIME_SECONDS: 43200 # 12 hours
CHAIN: ${{ matrix.chain }}

steps:
Expand Down Expand Up @@ -69,15 +69,6 @@ jobs:
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
fi

- name: Clean up Erigon data directory
if: always()
run: |
rm -rf $ERIGON_DATA_DIR

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Save test results
if: steps.test_step.outputs.test_executed == 'true'
env:
Expand All @@ -98,7 +89,18 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: test-results-${{ env.CHAIN }}
path: ${{ github.workspace }}/result-${{ env.CHAIN }}.json
path: |
${{ github.workspace }}/result-${{ env.CHAIN }}.json
${{ github.workspace }}/erigon_data/logs/erigon.log

- name: Clean up Erigon data directory
if: always()
run: |
rm -rf $ERIGON_DATA_DIR

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Action for Success
if: steps.test_step.outputs.TEST_RESULT == 'success'
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/qa-tip-tracking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: QA - Tip tracking

on:
schedule:
- cron: '0 0 * * 1-6' # Run every day at 00:00 AM UTC except Sunday
- cron: '0 0 * * 1-6' # Run every night at 00:00 AM UTC except Sunday
workflow_dispatch: # Run manually

jobs:
Expand Down Expand Up @@ -71,15 +71,6 @@ jobs:
echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
fi

- name: Delete Erigon Testbed Data Directory
if: always()
run: |
rm -rf $ERIGON_TESTBED_DATA_DIR

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Save test results
if: steps.test_step.outputs.test_executed == 'true'
env:
Expand All @@ -106,7 +97,18 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{ github.workspace }}/result-${{ env.CHAIN }}.json
path: |
${{ github.workspace }}/result-${{ env.CHAIN }}.json
${{ env.ERIGON_TESTBED_DATA_DIR }}/logs/erigon.log

- name: Delete Erigon Testbed Data Directory
if: always()
run: |
rm -rf $ERIGON_TESTBED_DATA_DIR

- name: Resume the Erigon instance dedicated to db maintenance
run: |
python3 $ERIGON_QA_PATH/test_system/db-producer/resume_production.py || true

- name: Action for Success
if: steps.test_step.outputs.TEST_RESULT == 'success'
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/test-kurtosis-assertoor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Kurtosis Assertoor GitHub Action

on:
schedule:
- cron: "0 2,14 * * *" # runs at 2am and 2pm UTC
workflow_dispatch:
# pull_request:
# branches:
# - kurtosis_assertoor
# types:
# - opened
# - reopened
# - synchronize
# - ready_for_review
# push:
# branches:
# - kurtosis_assertoor



jobs:
assertoor_test:
strategy:
matrix:
# list of os: https://github.com/actions/virtual-environments
os:
- { id: ubuntu-22.04, name: ubuntu }
runs-on: ${{ matrix.os.id }}

steps:
- uses: actions/checkout@v4
- name: make docker (see dockerhub for image builds)
run: DOCKER_TAG=thorax/erigon:ci-$GITHUB_SHA DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker


- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential

- name: download kurtosis config
run: |
wget -O kurtosis_config_with_p.yaml https://raw.githubusercontent.com/erigontech/erigon/kurtosis_assertoor/.github/workflows/kurtosis/config.yaml
sed 's/<<ERIGON_IMAGE_PLACEHOLDER>>/thorax\/erigon:ci-'$GITHUB_SHA'/' kurtosis_config_with_p.yaml > kurtosis_config.yaml

- name: Run Kurtosis + assertoor tests
uses: ethpandaops/kurtosis-assertoor-github-action@v1
with:
enclave_name: "kurtosis-run-${{ matrix.os.name }}-${{ github.run_id }}"
ethereum_package_args: "./kurtosis_config.yaml"
#kurtosis_extra_args: --verbosity detailed --cli-log-level trace
enclave_dump: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
build/_vendor/pkg
/*.a
docs/readthedocs/build

/.VSCodeCounter
#*
.#*
*#
Expand Down
4 changes: 2 additions & 2 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
}
}
gasCap = hi
b.pendingState.SetTxContext(libcommon.Hash{}, libcommon.Hash{}, len(b.pendingBlock.Transactions()))
b.pendingState.SetTxContext(libcommon.Hash{}, len(b.pendingBlock.Transactions()))

// Create a helper to check if a gas allowance results in an executable transaction
executable := func(gas uint64) (bool, *evmtypes.ExecutionResult, error) {
Expand Down Expand Up @@ -756,7 +756,7 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, txn types.Transa
return fmt.Errorf("invalid transaction nonce: got %d, want %d", txn.GetNonce(), nonce)
}

b.pendingState.SetTxContext(txn.Hash(), libcommon.Hash{}, len(b.pendingBlock.Transactions()))
b.pendingState.SetTxContext(txn.Hash(), len(b.pendingBlock.Transactions()))
//fmt.Printf("==== Start producing block %d, header: %d\n", b.pendingBlock.NumberU64(), b.pendingHeader.Number.Uint64())
if _, _, err := core.ApplyTransaction(
b.m.ChainConfig, core.GetHashFn(b.pendingHeader, b.getHeader), b.m.Engine,
Expand Down
6 changes: 5 additions & 1 deletion cl/antiquary/antiquary.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (
"github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks"
)

const safetyMargin = 2_000 // We retire snapshots 2k blocks after the finalized head
const safetyMargin = 10_000 // We retire snapshots 10k blocks after the finalized head

// Antiquary is where the snapshots go, aka old history, it is what keep track of the oldest records.
type Antiquary struct {
Expand Down Expand Up @@ -360,6 +360,10 @@ func (a *Antiquary) antiquateBlobs() error {
defer roTx.Rollback()
// perform blob antiquation if it is time to.
currentBlobsProgress := a.sn.FrozenBlobs()
// We should NEVER get ahead of the block snapshots.
if currentBlobsProgress >= a.sn.BlocksAvailable() {
return nil
}
minimunBlobsProgress := ((a.cfg.DenebForkEpoch * a.cfg.SlotsPerEpoch) / snaptype.Erigon2MergeLimit) * snaptype.Erigon2MergeLimit
currentBlobsProgress = max(currentBlobsProgress, minimunBlobsProgress)
// read the finalized head
Expand Down
12 changes: 9 additions & 3 deletions cl/antiquary/state_antiquary.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,9 @@ func (s *Antiquary) initializeStateAntiquaryIfNeeded(ctx context.Context, tx kv.
return err
}
// We want to backoff by some slots until we get a correct state from DB.
// we start from 1 * clparams.SlotsPerDump.
backoffStep := uint64(10)
// we start from 10 * clparams.SlotsPerDump.
backoffStrides := uint64(10)
backoffStep := backoffStrides

historicalReader := historical_states_reader.NewHistoricalStatesReader(s.cfg, s.snReader, s.validatorsTable, s.genesisState)

Expand All @@ -464,6 +465,11 @@ func (s *Antiquary) initializeStateAntiquaryIfNeeded(ctx context.Context, tx kv.
if err != nil {
return fmt.Errorf("failed to read historical state at slot %d: %w", attempt, err)
}
if s.currentState == nil {
log.Warn("historical state not found, backoff more and try again", "slot", attempt)
backoffStep += backoffStrides
continue
}

computedBlockRoot, err := s.currentState.BlockRoot()
if err != nil {
Expand All @@ -476,7 +482,7 @@ func (s *Antiquary) initializeStateAntiquaryIfNeeded(ctx context.Context, tx kv.
if computedBlockRoot != expectedBlockRoot {
log.Debug("Block root mismatch, trying again", "slot", attempt, "expected", expectedBlockRoot)
// backoff more
backoffStep += 10
backoffStep += backoffStrides
continue
}
break
Expand Down
Loading
Loading