mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Tests for init-sync DA (#12873)
* test coverage for commitmentsToCheck * test for WithinDAPeriod * gaz --------- Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
This commit is contained in:
@@ -63,6 +63,7 @@ go_test(
|
||||
gotags = ["develop"],
|
||||
race = "on",
|
||||
deps = [
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//encoding/bytesutil:go_default_library",
|
||||
"//io/file:go_default_library",
|
||||
"//testing/assert:go_default_library",
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/v4/config/params"
|
||||
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
||||
"github.com/prysmaticlabs/prysm/v4/testing/require"
|
||||
)
|
||||
|
||||
// Test cases can be executed in an arbitrary order. TestOverrideBeaconConfigTestTeardown checks
|
||||
@@ -51,3 +53,42 @@ func TestConfig_DataRace(t *testing.T) {
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func TestConfig_WithinDAPeriod(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
block primitives.Epoch
|
||||
current primitives.Epoch
|
||||
within bool
|
||||
}{
|
||||
{
|
||||
name: "before",
|
||||
block: 0,
|
||||
current: params.BeaconNetworkConfig().MinEpochsForBlobsSidecarsRequest + 1,
|
||||
within: false,
|
||||
},
|
||||
{
|
||||
name: "same",
|
||||
block: 0,
|
||||
current: 0,
|
||||
within: true,
|
||||
},
|
||||
{
|
||||
name: "boundary",
|
||||
block: 0,
|
||||
current: params.BeaconNetworkConfig().MinEpochsForBlobsSidecarsRequest,
|
||||
within: true,
|
||||
},
|
||||
{
|
||||
name: "one less",
|
||||
block: params.BeaconNetworkConfig().MinEpochsForBlobsSidecarsRequest - 1,
|
||||
current: params.BeaconNetworkConfig().MinEpochsForBlobsSidecarsRequest,
|
||||
within: true,
|
||||
},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
require.Equal(t, c.within, params.WithinDAPeriod(c.block, c.current))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user