Skip to content

Commit 74d4c70

Browse files
author
Darioush Jalali
committed
simplify
1 parent 21483b7 commit 74d4c70

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

plugin/evm/vm_warp_test.go

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@ var (
4747
exampleWarpABI string
4848
)
4949

50-
type warpMsgFrom int
51-
52-
const (
53-
fromSubnet warpMsgFrom = iota
54-
fromPrimary
55-
)
56-
5750
type useWarpMsgSigners int
5851

5952
const (
@@ -457,7 +450,6 @@ func TestReceiveWarpMessage(t *testing.T) {
457450
type test struct {
458451
name string
459452
sourceChainID ids.ID
460-
msgFrom warpMsgFrom
461453
useSigners useWarpMsgSigners
462454
blockTime time.Time
463455
}
@@ -467,21 +459,18 @@ func TestReceiveWarpMessage(t *testing.T) {
467459
{
468460
name: "subnet message should be signed by subnet without RequirePrimaryNetworkSigners",
469461
sourceChainID: vm.ctx.ChainID,
470-
msgFrom: fromSubnet,
471462
useSigners: signersSubnet,
472463
blockTime: upgrade.InitiallyActiveTime,
473464
},
474465
{
475466
name: "P-Chain message should be signed by subnet without RequirePrimaryNetworkSigners",
476467
sourceChainID: constants.PlatformChainID,
477-
msgFrom: fromPrimary,
478468
useSigners: signersSubnet,
479469
blockTime: upgrade.InitiallyActiveTime.Add(blockGap),
480470
},
481471
{
482472
name: "C-Chain message should be signed by subnet without RequirePrimaryNetworkSigners",
483473
sourceChainID: testCChainID,
484-
msgFrom: fromPrimary,
485474
useSigners: signersSubnet,
486475
blockTime: upgrade.InitiallyActiveTime.Add(2 * blockGap),
487476
},
@@ -490,21 +479,18 @@ func TestReceiveWarpMessage(t *testing.T) {
490479
{
491480
name: "subnet message should be signed by subnet with RequirePrimaryNetworkSigners (unimpacted)",
492481
sourceChainID: vm.ctx.ChainID,
493-
msgFrom: fromSubnet,
494482
useSigners: signersSubnet,
495483
blockTime: reEnableTime,
496484
},
497485
{
498486
name: "P-Chain message should be signed by subnet with RequirePrimaryNetworkSigners (unimpacted)",
499487
sourceChainID: constants.PlatformChainID,
500-
msgFrom: fromPrimary,
501488
useSigners: signersSubnet,
502489
blockTime: reEnableTime.Add(blockGap),
503490
},
504491
{
505492
name: "C-Chain message should be signed by primary with RequirePrimaryNetworkSigners (impacted)",
506493
sourceChainID: testCChainID,
507-
msgFrom: fromPrimary,
508494
useSigners: signersPrimary,
509495
blockTime: reEnableTime.Add(2 * blockGap),
510496
},
@@ -513,16 +499,14 @@ func TestReceiveWarpMessage(t *testing.T) {
513499
// time and cannot, eg be run in parallel or a separate golang test.
514500
for _, test := range tests {
515501
testReceiveWarpMessage(
516-
t, issuer, vm, test.sourceChainID, test.msgFrom, test.useSigners, test.blockTime,
502+
t, issuer, vm, test.sourceChainID, test.useSigners, test.blockTime,
517503
)
518504
}
519505
}
520506

521507
func testReceiveWarpMessage(
522508
t *testing.T, issuer chan commonEng.Message, vm *VM,
523-
sourceChainID ids.ID,
524-
msgFrom warpMsgFrom, useSigners useWarpMsgSigners,
525-
blockTime time.Time,
509+
sourceChainID ids.ID, useSigners useWarpMsgSigners, blockTime time.Time,
526510
) {
527511
require := require.New(t)
528512
payloadData := avagoUtils.RandomBytes(100)
@@ -585,10 +569,7 @@ func testReceiveWarpMessage(
585569

586570
vm.ctx.ValidatorState = &validatorstest.State{
587571
GetSubnetIDF: func(ctx context.Context, chainID ids.ID) (ids.ID, error) {
588-
if msgFrom == fromPrimary {
589-
return constants.PrimaryNetworkID, nil
590-
}
591-
return vm.ctx.SubnetID, nil
572+
return sourceChainID, nil
592573
},
593574
GetValidatorSetF: func(ctx context.Context, height uint64, subnetID ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) {
594575
if height < minimumValidPChainHeight {

0 commit comments

Comments
 (0)