2023-11-14 05:50:51 +00:00
|
|
|
package params
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
2023-11-14 05:50:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMaxRequestBlock(t *testing.T) {
|
|
|
|
testCases := []struct {
|
|
|
|
epoch primitives.Epoch
|
|
|
|
expectedMaxBlock uint64
|
|
|
|
description string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
epoch: primitives.Epoch(mainnetDenebForkEpoch - 1), // Assuming the fork epoch is not 0
|
2023-12-19 14:59:30 +00:00
|
|
|
expectedMaxBlock: mainnetBeaconConfig.MaxRequestBlocks,
|
2023-11-14 05:50:51 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
epoch: primitives.Epoch(mainnetDenebForkEpoch),
|
2023-12-16 11:37:44 +00:00
|
|
|
expectedMaxBlock: mainnetBeaconConfig.MaxRequestBlocksDeneb,
|
2023-11-14 05:50:51 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
t.Run(tc.description, func(t *testing.T) {
|
|
|
|
maxBlocks := MaxRequestBlock(tc.epoch)
|
|
|
|
if maxBlocks != tc.expectedMaxBlock {
|
|
|
|
t.Errorf("For epoch %d, expected max blocks %d, got %d", tc.epoch, tc.expectedMaxBlock, maxBlocks)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|