mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
* Add Save blob and tests * Remove locks * Remove test cleanup * Fix go mod * Cleanup * Add checksum * Add file hashing to fileutil * Move test * Check data when exists * Add one more test * Rename * Gaz * Add packaged level comment * Fix block proposals in the REST validator client (#13116) * Fix block proposals in the REST validator client * fix graffiti test * return empty graffiti * fallback to old endpoints * logs * handle 404 * everything passes * review from James * log undecoded value * test fixes and additions --------- Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> * fix head slot in log (#13139) * zig: Update zig to recent main branch commit (#13142) Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> * Fix Pending Queue Deadline Bug (#13145) * rearrange deadline * naming * Add pruning * Gaz * Gaz * Update pruning * Cleanup * Making a mess * Benchmarking * Forgot to add the file + fixes * Fixes * Pruning from DB fixed * Add prune by file data * Fix pruning * Prune fixes * Cleanup db blockRoot filter * Handle file close error * Fix deletion * Change read at + remove retentionEpich from bs * Gaz * Seperate logic + add detailed comments * Add tests * Add retention slot when creating blobStorage * Fix tests * Gaz * Fix testonly import * Fix linter errors * Fix retentionSlot calculation * Move + use MaxEpochsToPersistBlobs * Remove unused ctx * Prestons suggestion Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com> * Rename --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com> Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com> Co-authored-by: Nishant Das <nishdas93@gmail.com>
40 lines
1.6 KiB
Go
40 lines
1.6 KiB
Go
package filesystem
|
|
|
|
import (
|
|
"flag"
|
|
"strconv"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/cmd/beacon-chain/flags"
|
|
"github.com/prysmaticlabs/prysm/v4/config/params"
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
|
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func TestConfigureBlobRetentionEpoch(t *testing.T) {
|
|
MaxEpochsToPersistBlobs = params.BeaconNetworkConfig().MinEpochsForBlobsSidecarsRequest
|
|
params.SetupTestConfigCleanup(t)
|
|
app := cli.App{}
|
|
set := flag.NewFlagSet("test", 0)
|
|
|
|
// Test case: Spec default.
|
|
require.NoError(t, ConfigureBlobRetentionEpoch(cli.NewContext(&app, set, nil)))
|
|
require.Equal(t, params.BeaconNetworkConfig().MinEpochsForBlobsSidecarsRequest, MaxEpochsToPersistBlobs)
|
|
|
|
set.Uint64(flags.BlobRetentionEpoch.Name, 0, "")
|
|
minEpochsForSidecarRequest := uint64(params.BeaconNetworkConfig().MinEpochsForBlobsSidecarsRequest)
|
|
require.NoError(t, set.Set(flags.BlobRetentionEpoch.Name, strconv.FormatUint(2*minEpochsForSidecarRequest, 10)))
|
|
cliCtx := cli.NewContext(&app, set, nil)
|
|
|
|
// Test case: Input epoch is greater than or equal to spec value.
|
|
require.NoError(t, ConfigureBlobRetentionEpoch(cliCtx))
|
|
require.Equal(t, primitives.Epoch(2*minEpochsForSidecarRequest), MaxEpochsToPersistBlobs)
|
|
|
|
// Test case: Input epoch is less than spec value.
|
|
require.NoError(t, set.Set(flags.BlobRetentionEpoch.Name, strconv.FormatUint(minEpochsForSidecarRequest-1, 10)))
|
|
cliCtx = cli.NewContext(&app, set, nil)
|
|
err := ConfigureBlobRetentionEpoch(cliCtx)
|
|
require.ErrorContains(t, "blob-retention-epochs smaller than spec default", err)
|
|
}
|