mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 12:10:05 +00:00
288b38be8e
* Add `process_execution_payload` to `process_block` * bring in bellatrix p2p changes * lint * fix testcase to use MaxChunkSize as config to change allowed size instead of config * add left out config params * Fix TestForkSchedule_CorrectNumberOfForks * fixed Nishant's comments * gofmt * add switch case Co-authored-by: Mohamed Zahoor <zahoor@zahoor.in> Co-authored-by: Zahoor Mohamed <zahoor@prysmaticlabs.com> Co-authored-by: Nishant Das <nishdas93@gmail.com>
52 lines
1.5 KiB
Go
52 lines
1.5 KiB
Go
package p2p
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
eth2types "github.com/prysmaticlabs/eth2-types"
|
|
"github.com/prysmaticlabs/prysm/config/params"
|
|
"github.com/prysmaticlabs/prysm/encoding/bytesutil"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/testing/assert"
|
|
)
|
|
|
|
func TestMappingHasNoDuplicates(t *testing.T) {
|
|
m := make(map[reflect.Type]bool)
|
|
for _, v := range gossipTopicMappings {
|
|
if _, ok := m[reflect.TypeOf(v)]; ok {
|
|
t.Errorf("%T is duplicated in the topic mapping", v)
|
|
}
|
|
m[reflect.TypeOf(v)] = true
|
|
}
|
|
}
|
|
|
|
func TestGossipTopicMappings_CorrectBlockType(t *testing.T) {
|
|
params.SetupTestConfigCleanup(t)
|
|
bCfg := params.BeaconConfig()
|
|
altairForkEpoch := eth2types.Epoch(100)
|
|
BellatrixForkEpoch := eth2types.Epoch(200)
|
|
|
|
bCfg.AltairForkEpoch = altairForkEpoch
|
|
bCfg.BellatrixForkEpoch = BellatrixForkEpoch
|
|
bCfg.ForkVersionSchedule[bytesutil.ToBytes4(bCfg.AltairForkVersion)] = eth2types.Epoch(100)
|
|
bCfg.ForkVersionSchedule[bytesutil.ToBytes4(bCfg.BellatrixForkVersion)] = eth2types.Epoch(200)
|
|
params.OverrideBeaconConfig(bCfg)
|
|
|
|
// Phase 0
|
|
pMessage := GossipTopicMappings(BlockSubnetTopicFormat, 0)
|
|
_, ok := pMessage.(*ethpb.SignedBeaconBlock)
|
|
assert.Equal(t, true, ok)
|
|
|
|
// Altair Fork
|
|
pMessage = GossipTopicMappings(BlockSubnetTopicFormat, altairForkEpoch)
|
|
_, ok = pMessage.(*ethpb.SignedBeaconBlockAltair)
|
|
assert.Equal(t, true, ok)
|
|
|
|
// Bellatrix Fork
|
|
pMessage = GossipTopicMappings(BlockSubnetTopicFormat, BellatrixForkEpoch)
|
|
_, ok = pMessage.(*ethpb.SignedBeaconBlockMerge)
|
|
assert.Equal(t, true, ok)
|
|
|
|
}
|