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

Merge pre v2.57 #81

Merged
merged 126 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
77d32cc
"downloader manifest": cmd to produce manifest.txt (#9067)
AskAlexSharov Dec 24, 2023
e08003f
block retire: merge all possible files (even bor) even if nothing to …
AskAlexSharov Dec 24, 2023
2944abb
fix typo in snap webseed server names (#9072)
AskAlexSharov Dec 24, 2023
eaf0348
[Grindmas] Added tests to Beacon API, also fixed stuff. (#9074)
Giulio2002 Dec 25, 2023
ab4a00f
disable TestSentinelStatusRequest (failing on WIN CI) (#9076)
AskAlexSharov Dec 25, 2023
bc50bd5
make 500K files also seedable (because they actually are) (#9077)
AskAlexSharov Dec 25, 2023
0d31444
bor mainnet 51m (#9073)
AskAlexSharov Dec 25, 2023
9f9e364
Update Polygon storage requirements (#9014)
yperbasis Dec 25, 2023
cdb4731
Added Validators endpoint to Beacon API (#9080)
Giulio2002 Dec 25, 2023
a48db43
return deleted caplin-v2 webseed (#9083)
AskAlexSharov Dec 26, 2023
df0699a
Added sentry simulator implementation (#9087)
mh0lt Dec 27, 2023
79ed8ca
E2 snapshot uploading (#9056)
mh0lt Dec 27, 2023
398bcb5
rpc: implement txpool_contentFrom (#9057)
jsvisa Dec 28, 2023
698ee60
Beacon API: Added attestation rewards endpoint. (#9091)
Giulio2002 Dec 28, 2023
ab27531
Introduce new public buckets for the snapshots (#9094)
AlexeyAkhunov Dec 28, 2023
6770487
borheimdall: add tests for validator set and selected proposers valid…
taratorio Dec 28, 2023
1f237c0
borheimdall: only fetch next span when in last sprint of current span…
taratorio Dec 28, 2023
f8cc27a
heimdall: use span id as naming (#9097)
taratorio Dec 28, 2023
fc9dae1
heimdall: add max retries to heimdall client (#9098)
taratorio Dec 28, 2023
b562eff
heimdall: better error logging for clerk/event-record/list nil respon…
taratorio Dec 30, 2023
510d62a
[caplin] sse handler placeholder (#9082)
elee1766 Dec 30, 2023
78bb3cd
[caplin] topic strings (#9000)
elee1766 Dec 30, 2023
46ecf03
Added GET /eth/v1/beacon/rewards/blocks/{block_id} and POST /eth/v1/b…
Giulio2002 Dec 30, 2023
19bc328
Added db loggers to all db callers and fixed flag settings (#9099)
mh0lt Dec 31, 2023
580c555
Make caplin snapshots downloadable (only sepolia) (#9105)
Giulio2002 Dec 31, 2023
a959387
Make caplin sync snapshots (all of them) (#9106)
Giulio2002 Jan 1, 2024
bab123c
more endpoints (#9109)
elee1766 Jan 1, 2024
13da868
Added RANDAO Api (#9108)
Giulio2002 Jan 1, 2024
415b17c
Updated erigon-snapshots (#9111)
Giulio2002 Jan 2, 2024
3d10cee
Make Caplin work with Otterscan (#9115)
Giulio2002 Jan 2, 2024
777f5dc
added collection for log prefix (#9118)
dvovk Jan 3, 2024
a2274f3
chore(cmd/evm):fix link jump in cmd/evm/README.md (#9114)
ddl-hust Jan 3, 2024
a645ef6
Update README.md (#9112)
oxbau Jan 3, 2024
391b267
Schedule Dencun for Görli (#9116)
yperbasis Jan 3, 2024
b94ca6d
devnet: fix ws port clash for state-sync scenario (#9125)
taratorio Jan 3, 2024
18baf81
Caplin: Fixed Invalid reading for historical states (#9124)
Giulio2002 Jan 3, 2024
82822ee
erigon snapshots integrity: add check for body.BaseTxnID (#9121)
AskAlexSharov Jan 4, 2024
b57cbdc
polygon/sync: canonical chain builder (#9117)
battlmonstr Jan 4, 2024
9cd5f58
data (#9126)
elee1766 Jan 4, 2024
3eeb572
params: begin 2.57 release cycle (#9144)
yperbasis Jan 5, 2024
ebe16d8
bor: BorConfig setup fix (#9145)
battlmonstr Jan 5, 2024
98cc1ee
stagedsync: implement bor span for chain reader and fix loggers (#9146)
taratorio Jan 5, 2024
e958d35
Added Heads method to Beacon API (#9135)
Giulio2002 Jan 6, 2024
235af8a
glob filter (#9148)
elee1766 Jan 7, 2024
15ff418
Change retire progress log level to debug (#9153)
mh0lt Jan 8, 2024
134dc85
add amoy bootnodes (#9158)
temaniarpit27 Jan 8, 2024
fe9bc35
Added GetEth1V1BuilderStatesExpectedWithdrawals (#9152)
Giulio2002 Jan 8, 2024
2cbe8b7
downloader: `--verify --verify.files --verify.failfast` support (#9156)
AskAlexSharov Jan 8, 2024
7490e7d
up `x` and `cli` deps (#9154)
AskAlexSharov Jan 8, 2024
b4fd278
clean-exit test: bump golang version to 1.21 (#9160)
mriccobene Jan 8, 2024
ff92b70
dvovk/updsync (#9134)
dvovk Jan 8, 2024
de6c159
"erigon snapshots retire" - doesn't see any files because version is …
AskAlexSharov Jan 8, 2024
2521f47
polygon/sync: canonical chain builder unit tests (#9137)
battlmonstr Jan 8, 2024
b2fa618
Caplin: Fixed crash in OnAttestation (#9159)
Giulio2002 Jan 8, 2024
b4e6563
fixed sync.loop flags (#9167)
dvovk Jan 8, 2024
19b9504
stagedsync: borheimdall segments min check minor improvement (#9168)
taratorio Jan 8, 2024
36fefbb
downloader: verify fixempty (#9161)
AskAlexSharov Jan 9, 2024
b25d8cc
disable TestGetValidatorsBalances: oom on CI (#9131)
AskAlexSharov Jan 9, 2024
22f7615
disable TestStateAntiquaryCapella because of oom on CI (#9129)
AskAlexSharov Jan 9, 2024
459ccf8
[E3] Some fixes for the in-memory database when working with Caplin (…
AlexeyAkhunov Jan 9, 2024
302f1f7
ci: run macOS jobs on macos-13 instead of macos-13-xlarge (#9177)
battlmonstr Jan 9, 2024
74ec3a9
stagedsync: fix bor heimdall mining flow (#9149)
taratorio Jan 9, 2024
e25b15b
remotedbserver: add support for bor snapshots (#9180)
taratorio Jan 9, 2024
fec0c9e
docs: fix typos (#9173)
vuittont60 Jan 9, 2024
af913fd
bor: fix for TestMiningBenchmark (#9182)
taratorio Jan 9, 2024
9c47cce
bor: move to polygon directory (#9174)
battlmonstr Jan 9, 2024
8db023b
Schedule Dencun for Chiado (#9184)
yperbasis Jan 9, 2024
0cfe661
devnet: fix infinite recursion & enable TestStateSync & TestCallContr…
taratorio Jan 9, 2024
ceeb090
mdbx: hard dirtyPages limit (#9178)
AskAlexSharov Jan 10, 2024
95109d9
erigon-lib: cleanup unnnecessary import in tools.go added in prev PR …
taratorio Jan 10, 2024
09ec1f1
Fix DenebForkEpoch for Chiado (#9188)
yperbasis Jan 10, 2024
284aa1d
Added EthV1AggregateAndProofs API (#9192)
Giulio2002 Jan 10, 2024
b05ffc9
Fixes for Bor Block Production Synchronization (#9162)
mh0lt Jan 10, 2024
f690301
devnet: integration tests port clash fix (#9194)
taratorio Jan 10, 2024
641f53e
Remove duplicate flags (#9199)
mh0lt Jan 11, 2024
1ee439e
mdbx: dplimit - support cgroups/gomelimit, avoid using SetOptions aft…
AskAlexSharov Jan 11, 2024
b1c3006
bor: remove duplicate validator_set file and debug logger (#9198)
battlmonstr Jan 11, 2024
470f05e
clean-exit test: increase test time (#9193)
mriccobene Jan 11, 2024
7308e87
Fix txpool queue overflow (#9197)
mh0lt Jan 11, 2024
9a9808f
build(deps): bump github.com/quic-go/quic-go from 0.38.1 to 0.38.2 (#…
dependabot[bot] Jan 11, 2024
0449818
p2p/discv4: revert gotreply handler change from #8661 (#9119) (#9195)
battlmonstr Jan 11, 2024
c1e3ec5
deps: upgrade go-multiaddr to v0.12.1 (#9208)
yperbasis Jan 11, 2024
8315033
Added more checks on state reconstruction + made history reconstructi…
Giulio2002 Jan 11, 2024
66cd4e7
Mumbai uploader regression fixes (#9212)
mh0lt Jan 11, 2024
3bb1917
recsplit: reduce ram pressure (#9218)
AskAlexSharov Jan 12, 2024
e806db9
mdbx: reduce 2 times hard dplimit (#9216)
AskAlexSharov Jan 12, 2024
fa1e1ba
Tests v13 fix (#9200)
racytech Jan 12, 2024
db1dcbb
refactor(erigon-lib/metrics): replace strings.IndexByte with strings.…
ddl-hust Jan 12, 2024
574ec80
caplin state_antiqate: reduce worst case ram limit (#9217)
AskAlexSharov Jan 12, 2024
a191296
Deneb integration to Caplin (#9093)
bayram98 Jan 12, 2024
c11e504
polygon: refactor header.Time validation (#9213)
battlmonstr Jan 12, 2024
a592cbf
Removed the check for milestoneID in the GetVoteOnHash() (#9021)
temaniarpit27 Jan 12, 2024
320fe0a
Don't run pos downloader or engine api for bor (#9220)
mh0lt Jan 12, 2024
52a9487
polygon: refactor header validations for reuse in sync (#9224)
battlmonstr Jan 12, 2024
7b58dab
Added LightClient Containers (#9222)
Giulio2002 Jan 13, 2024
2b0fd6d
chore: some proofreading in the docs (#9223)
Pan-chao Jan 13, 2024
d8b91c4
Fix startup sync for txpool processing for bor block production (#9219)
mh0lt Jan 13, 2024
ac9f9e0
polygon/sync: fork choice logic (#9228)
battlmonstr Jan 14, 2024
8d4d4d8
refac some (#9185)
elee1766 Jan 15, 2024
c5b75d0
polygon/sync: span updates (#9229)
battlmonstr Jan 15, 2024
fb0226d
polygon/sync: move PeersWithBlockNumInfo and mocks, refactor bor.GetR…
battlmonstr Jan 15, 2024
a7d5b55
rpcdaemon: fix remote bor engine for trace transaction (#9214)
taratorio Jan 15, 2024
f03d266
Added merkle proof and fixed bad handling of new validators (#9233)
Giulio2002 Jan 15, 2024
cda48ae
polygon/heimdall: drop GRPC support (#9230)
battlmonstr Jan 15, 2024
79499b5
refactor(p2p/dnsdisc): replace strings.IndexByte with strings.Cut (#9…
ddl-hust Jan 15, 2024
2793ef6
polygon: flatten redundant packages (#9241)
battlmonstr Jan 16, 2024
e979d79
p2p: panic in enode DB Close on shutdown (#9237) (#9240)
battlmonstr Jan 16, 2024
a1eee5e
fix udpOrHttpTrackers amount (#9245)
ddl-hust Jan 17, 2024
26ce6aa
return 1 lost mainnet file (#9242)
AskAlexSharov Jan 17, 2024
dd010bb
qa tests: add clean exit test on block downloading (#9238)
mriccobene Jan 17, 2024
e1195ba
ci: Use GITHUB_OUTPUT envvar instead of set-output command (#9215)
arunsathiya Jan 17, 2024
e1a1c0c
Caplin: Fixed goroutine hell (#9246)
Giulio2002 Jan 17, 2024
8f6fe88
Update TestGoerliForkDigest after Dencun (#9251)
yperbasis Jan 17, 2024
b38e17e
Implement PIP-33: Napoli Hardfork (#8975)
yperbasis Jan 17, 2024
5e5d849
Move blob cache check in txpool (#9250)
somnathb1 Jan 17, 2024
1914b52
mdbx: race conditions in MdbxKV.Close (#8409) (#9244)
battlmonstr Jan 17, 2024
4abc6cd
Schedule Dencun for Sepolia & Holešky (#9255)
yperbasis Jan 18, 2024
3040e25
logs: remove "height=unknown" (#9261)
yperbasis Jan 18, 2024
4864674
Merge commit '3040e2576c29512addaf8ce50528609b4ff9a8e0' into HEAD
jyellick Jan 24, 2024
9af1499
p2p/sentry/simulator: skip TestSimulatorStart - manual runs only for …
taratorio Jan 23, 2024
81b9d4f
Update golangci to ignore slightly larger structs
jyellick Jan 24, 2024
92e3dbe
Set initial gas limit in txpool
jyellick Feb 7, 2024
168ef78
Suppress 'unwinding to previous canonical block'
jyellick Feb 7, 2024
f98041d
Appropriately set fork.yaml base commit
jyellick Feb 7, 2024
302e86f
Reduce diff slightly, merge conflicts less likely
jyellick Feb 7, 2024
233a689
Updated sepolia fork digest in tests (#9352)
Giulio2002 Jan 31, 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
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ jobs:
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
strategy:
matrix:
os: [ ubuntu-22.04 ] # Disabling macos as getting inexplicable "this job failed" messages with no logs, macos-13-xlarge ] # list of os: https://github.com/actions/virtual-environments
# list of os: https://github.com/actions/virtual-environments
os:
- ubuntu-22.04
- macos-13
runs-on: ${{ matrix.os }}

steps:
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/qa-clean-exit-block-downloading.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: QA - Clean exit (block downloading)

on:
push:
branches:
- 'release/**'
pull_request:
branches:
- devel
- 'release/**'
types:
- ready_for_review

jobs:
long-running-test:
runs-on: self-hosted
env:
ERIGON_REFERENCE_DATA_DIR: /opt/erigon-release/datadir
ERIGON_TESTBED_DATA_DIR: /opt/erigon-testbed/datadir
WORKING_TIME_SECONDS: 600

steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

#- name: Install dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y build-essential make gcc

- name: Restore Erigon Testbed Data Directory
run: |
rsync -av --delete $ERIGON_REFERENCE_DATA_DIR/ $ERIGON_TESTBED_DATA_DIR/

- name: Clean Erigon Build Directory
run: |
make clean

- name: Build Erigon
run: |
make erigon
working-directory: ${{ github.workspace }}

#- name: Download Python Script for Logs Checking
# run: |
# curl -o check_erigon_exit.py 'https://gist.githubusercontent.com/mriccobene/8db4030a745de34d527f136f2caa104f/raw/3c1a860cb87d61075e78ce399e17f0ab157cacc6/check_erigon_exit.py'

- name: Run Erigon, send ctrl-c and check for clean exiting
run: |
# Run Erigon, send ctrl-c and check logs
python3 ${{ github.workspace }}/../../../../erigon-qa/test_system/qa-tests/clean-exit/run_and_check_clean_exit.py ${{ github.workspace }}/build/bin $ERIGON_TESTBED_DATA_DIR $WORKING_TIME_SECONDS

# Capture monitoring script exit status
monitoring_exit_status=$?

# Clean up Erigon process if it's still running
if kill -0 $ERIGON_PID 2> /dev/null; then
echo "Terminating Erigon"
kill $ERIGON_PID
wait $ERIGON_PID
else
echo "Erigon has already terminated"
fi

# Check monitoring script exit status
if [ $monitoring_exit_status -eq 0 ]; then
echo "Monitoring completed successfully"
else
echo "Error detected in Erigon logs or monitoring script exited unexpectedly"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: QA - Clean exit on Ctrl-C
name: QA - Clean exit (snapshot downloading)

on:
push:
Expand All @@ -19,14 +19,10 @@ on:

jobs:
long-running-test:
#if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
#strategy:
# matrix:
# os: [ ubuntu-22.04, macos-13-xlarge ]
#runs-on: ${{ matrix.os }}
runs-on: self-hosted
env:
ERIGON_DATA_DIR: ${{ github.workspace }}/erigon_data
WORKING_TIME_SECONDS: 600

steps:
- name: Check out repository
Expand All @@ -35,7 +31,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'

- name: Set up Python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -63,7 +59,7 @@ jobs:
- name: Run Erigon, send ctrl-c and check for clean exiting
run: |
# Run Erigon, send ctrl-c and check logs
python3 ${{ github.workspace }}/../../../../erigon-qa/test_system/qa-tests/clean-exit/run_and_check_clean_exit.py ${{ github.workspace }}/build/bin $ERIGON_DATA_DIR
python3 ${{ github.workspace }}/../../../../erigon-qa/test_system/qa-tests/clean-exit/run_and_check_clean_exit.py ${{ github.workspace }}/build/bin $ERIGON_DATA_DIR $WORKING_TIME_SECONDS

# Capture monitoring script exit status
monitoring_exit_status=$?
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=tag_name::${TAG}
echo "tag_name=${TAG}" >> $GITHUB_OUTPUT

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ jobs:
tests:
strategy:
matrix:
os: [ ubuntu-22.04 ] # Disable macos as it is giving us "This Job Failed" errors with no logs, macos-13-xlarge ] # list of os: https://github.com/actions/virtual-environments
# list of os: https://github.com/actions/virtual-environments
os:
- ubuntu-22.04
- macos-13
runs-on: ${{ matrix.os }}

steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,5 @@ node_modules
/config.toml
/config.yaml
/config.yml

vendor
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ linters-settings:
rules: "rules.go"
hugeParam:
# size in bytes that makes the warning trigger (default 80)
sizeThreshold: 1000
sizeThreshold: 1100
rangeExprCopy:
# size in bytes that makes the warning trigger (default 512)
sizeThreshold: 512
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ COMMANDS += sentinel
COMMANDS += caplin
COMMANDS += caplin-regression
COMMANDS += tooling
COMMANDS += snapshots




Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ System Requirements

* Gnosis Chain Archive: 600GB (October 2023).

* Polygon Mainnet Archive: 5TB. (April 2022). `--prune.*.older 15768000`: 5.1Tb (Sept 2023). Polygon Mumbai Archive:
* Polygon Mainnet Archive: 8.5TiB (December 2023). `--prune.*.older 15768000`: 5.1Tb (September 2023). Polygon Mumbai Archive:
1TB. (April 2022).

SSD or NVMe. Do not recommend HDD - on HDD Erigon will always stay N blocks behind chain tip, but not fall behind.
Expand Down
5 changes: 4 additions & 1 deletion cl/abstract/beacon_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type BeaconStateUpgradable interface {
}

type BeaconStateExtension interface {
SlashValidator(slashedInd uint64, whistleblowerInd *uint64) error
SlashValidator(slashedInd uint64, whistleblowerInd *uint64) (uint64, error)
InitiateValidatorExit(index uint64) error
GetActiveValidatorsIndices(epoch uint64) (indicies []uint64)
GetTotalActiveBalance() uint64
Expand All @@ -40,6 +40,7 @@ type BeaconStateExtension interface {
ValidatorIndexByPubkey(key [48]byte) (uint64, bool)
PreviousStateRoot() common.Hash
SetPreviousStateRoot(root common.Hash)
GetValidatorActivationChurnLimit() uint64
}

type BeaconStateBasic interface {
Expand Down Expand Up @@ -162,6 +163,8 @@ type BeaconStateMinimal interface {
Eth1Data() *cltypes.Eth1Data
Eth1DataVotes() *solid.ListSSZ[*cltypes.Eth1Data]
Eth1DepositIndex() uint64
ValidatorSet() *solid.ValidatorSet
PreviousEpochParticipation() *solid.BitList

ForEachValidator(fn func(v solid.Validator, idx int, total int) bool)
ValidatorForValidatorIndex(index int) (solid.Validator, error)
Expand Down
17 changes: 9 additions & 8 deletions cl/antiquary/antiquary.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Antiquary struct {
beaconDB persistence.BlockSource
backfilled *atomic.Bool
cfg *clparams.BeaconChainConfig
states bool
states, blocks bool
fs afero.Fs
validatorsTable *state_accessors.StaticValidatorTable
genesisState *state.CachingBeaconState
Expand All @@ -43,7 +43,7 @@ type Antiquary struct {
balances32 []byte
}

func NewAntiquary(ctx context.Context, genesisState *state.CachingBeaconState, validatorsTable *state_accessors.StaticValidatorTable, cfg *clparams.BeaconChainConfig, dirs datadir.Dirs, downloader proto_downloader.DownloaderClient, mainDB kv.RwDB, sn *freezeblocks.CaplinSnapshots, reader freezeblocks.BeaconSnapshotReader, beaconDB persistence.BlockSource, logger log.Logger, states bool, fs afero.Fs) *Antiquary {
func NewAntiquary(ctx context.Context, genesisState *state.CachingBeaconState, validatorsTable *state_accessors.StaticValidatorTable, cfg *clparams.BeaconChainConfig, dirs datadir.Dirs, downloader proto_downloader.DownloaderClient, mainDB kv.RwDB, sn *freezeblocks.CaplinSnapshots, reader freezeblocks.BeaconSnapshotReader, beaconDB persistence.BlockSource, logger log.Logger, states, blocks bool, fs afero.Fs) *Antiquary {
backfilled := &atomic.Bool{}
backfilled.Store(false)
return &Antiquary{
Expand All @@ -61,12 +61,13 @@ func NewAntiquary(ctx context.Context, genesisState *state.CachingBeaconState, v
fs: fs,
validatorsTable: validatorsTable,
genesisState: genesisState,
blocks: blocks,
}
}

// Antiquate is the function that starts transactions seeding and shit, very cool but very shit too as a name.
func (a *Antiquary) Loop() error {
if a.downloader == nil {
if a.downloader == nil || !a.blocks {
return nil // Just skip if we don't have a downloader
}
// Skip if we dont support backfilling for the current network
Expand Down Expand Up @@ -94,7 +95,6 @@ func (a *Antiquary) Loop() error {
return err
}
// Here we need to start mdbx transaction and lock the thread
log.Info("[Antiquary]: Stopping Caplin to process historical indicies")
tx, err := a.mainDB.BeginRw(a.ctx)
if err != nil {
return err
Expand All @@ -110,6 +110,7 @@ func (a *Antiquary) Loop() error {
return err
}
defer logInterval.Stop()
log.Info("[Antiquary]: Stopping Caplin to process historical indicies", "from", from, "to", a.sn.BlocksAvailable())

// Now write the snapshots as indicies
for i := from; i < a.sn.BlocksAvailable(); i++ {
Expand Down Expand Up @@ -208,7 +209,7 @@ func (a *Antiquary) Loop() error {
if to-from < snaptype.Erigon2MergeLimit {
continue
}
if err := a.antiquate(from, to); err != nil {
if err := a.antiquate(a.sn.Version(), from, to); err != nil {
return err
}
case <-a.ctx.Done():
Expand All @@ -217,12 +218,12 @@ func (a *Antiquary) Loop() error {
}

// Antiquate will antiquate a specific block range (aka. retire snapshots), this should be ran in the background.
func (a *Antiquary) antiquate(from, to uint64) error {
func (a *Antiquary) antiquate(version uint8, from, to uint64) error {
if a.downloader == nil {
return nil // Just skip if we don't have a downloader
}
log.Info("[Antiquary]: Antiquating", "from", from, "to", to)
if err := freezeblocks.DumpBeaconBlocks(a.ctx, a.mainDB, a.beaconDB, from, to, snaptype.Erigon2MergeLimit, a.dirs.Tmp, a.dirs.Snap, 1, log.LvlDebug, a.logger); err != nil {
if err := freezeblocks.DumpBeaconBlocks(a.ctx, a.mainDB, a.beaconDB, version, from, to, snaptype.Erigon2MergeLimit, a.dirs.Tmp, a.dirs.Snap, 1, log.LvlDebug, a.logger); err != nil {
return err
}

Expand All @@ -248,7 +249,7 @@ func (a *Antiquary) antiquate(from, to uint64) error {
}
// Notify bittorent to seed the new snapshots
if _, err := a.downloader.Add(a.ctx, &proto_downloader.AddRequest{Items: downloadItems}); err != nil {
return err
log.Warn("[Antiquary]: Failed to add items to bittorent", "err", err)
}

tx, err := a.mainDB.BeginRw(a.ctx)
Expand Down
Loading
Loading