mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
d41d523050
"whitelisting" mechanism (list of files - stored in DB) - which protecting us from downloading new files after upgrade/downgrade was broken. And seems it became over-complicated with time. I replacing it by 1 persistent flag inside downloader: "prohibit_new_downloads.lock" Erigon will turn downloader into this mode after downloading/verification of first snapshots. ``` //Corner cases: // - Erigon generated file X with hash H1. User upgraded Erigon. New version has preverified file X with hash H2. Must ignore H2 (don't send to Downloader) // - Erigon "download once": means restart/upgrade/downgrade must not download files (and will be fast) // - After "download once" - Erigon will produce and seed new files ``` ------ `downloader --seedbox` is never "prohibit new downloads"
51 lines
1.6 KiB
Go
51 lines
1.6 KiB
Go
package antiquary
|
|
|
|
import (
|
|
"context"
|
|
_ "embed"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/common/datadir"
|
|
"github.com/ledgerwatch/erigon-lib/kv/memdb"
|
|
"github.com/ledgerwatch/erigon/cl/antiquary/tests"
|
|
"github.com/ledgerwatch/erigon/cl/clparams"
|
|
"github.com/ledgerwatch/erigon/cl/cltypes"
|
|
state_accessors "github.com/ledgerwatch/erigon/cl/persistence/state"
|
|
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
|
|
"github.com/ledgerwatch/log/v3"
|
|
"github.com/spf13/afero"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func runTest(t *testing.T, blocks []*cltypes.SignedBeaconBlock, preState, postState *state.CachingBeaconState) {
|
|
db := memdb.NewTestDB(t)
|
|
reader := tests.LoadChain(blocks, db)
|
|
|
|
ctx := context.Background()
|
|
vt := state_accessors.NewStaticValidatorTable()
|
|
f := afero.NewMemMapFs()
|
|
a := NewAntiquary(ctx, preState, vt, &clparams.MainnetBeaconConfig, datadir.New("/tmp"), nil, db, nil, reader, nil, log.New(), true, f)
|
|
require.NoError(t, a.IncrementBeaconState(ctx, blocks[len(blocks)-1].Block.Slot+33))
|
|
// TODO: add more meaning here, like checking db values, will do so once i see some bugs
|
|
}
|
|
|
|
func TestStateAntiquaryCapella(t *testing.T) {
|
|
t.Skip()
|
|
blocks, preState, postState := tests.GetCapellaRandom()
|
|
runTest(t, blocks, preState, postState)
|
|
}
|
|
|
|
func TestStateAntiquaryBellatrix(t *testing.T) {
|
|
t.Skip()
|
|
blocks, preState, postState := tests.GetBellatrixRandom()
|
|
fmt.Println(len(blocks))
|
|
runTest(t, blocks, preState, postState)
|
|
}
|
|
|
|
func TestStateAntiquaryPhase0(t *testing.T) {
|
|
t.Skip()
|
|
blocks, preState, postState := tests.GetPhase0Random()
|
|
runTest(t, blocks, preState, postState)
|
|
}
|