1
- import { expect } from "chai " ;
2
- import bls , { init } from "@chainsafe/bls/switchable " ;
1
+ import { describe , it , expect , beforeAll , vi } from "vitest " ;
2
+ import bls from "@chainsafe/bls" ;
3
3
import { createBeaconConfig } from "@lodestar/config" ;
4
4
import { chainConfig } from "@lodestar/config/default" ;
5
5
import { EPOCHS_PER_SYNC_COMMITTEE_PERIOD , SLOTS_PER_EPOCH } from "@lodestar/params" ;
@@ -9,7 +9,6 @@ import {BeaconChainLcMock} from "../mocks/BeaconChainLcMock.js";
9
9
import { processLightClientUpdate } from "../utils/naive/update.js" ;
10
10
import { IBeaconChainLc , prepareUpdateNaive } from "../utils/prepareUpdateNaive.js" ;
11
11
import { getInteropSyncCommittee , getSyncAggregateSigningRoot , SyncCommitteeKeys } from "../utils/utils.js" ;
12
- import { isNode } from "../../src/utils/utils.js" ;
13
12
14
13
function getSyncCommittee (
15
14
syncCommitteesKeys : Map < SyncPeriod , SyncCommitteeKeys > ,
@@ -25,7 +24,7 @@ function getSyncCommittee(
25
24
26
25
describe ( "syncInMemory" , function ( ) {
27
26
// In browser test this process is taking more time than default 2000ms
28
- this . timeout ( 10000 ) ;
27
+ vi . setConfig ( { testTimeout : 10000 } ) ;
29
28
30
29
// Fixed params
31
30
const genValiRoot = Buffer . alloc ( 32 , 9 ) ;
@@ -35,20 +34,14 @@ describe("syncInMemory", function () {
35
34
let updateData : { chain : IBeaconChainLc ; blockWithSyncAggregate : altair . BeaconBlock } ;
36
35
let update : altair . LightClientUpdate ;
37
36
38
- before ( "init bls" , async ( ) => {
39
- // This process has to be done manually because of an issue in Karma runner
40
- // https://github.com/karma-runner/karma/issues/3804
41
- await init ( isNode ? "blst-native" : "herumi" ) ;
42
- } ) ;
43
-
44
- before ( "BLS sanity check" , ( ) => {
37
+ beforeAll ( ( ) => {
45
38
const sk = bls . SecretKey . fromBytes ( Buffer . alloc ( 32 , 1 ) ) ;
46
- expect ( sk . toPublicKey ( ) . toHex ( ) ) . to . equal (
39
+ expect ( sk . toPublicKey ( ) . toHex ( ) ) . toBe (
47
40
"0xaa1a1c26055a329817a5759d877a2795f9499b97d6056edde0eea39512f24e8bc874b4471f0501127abb1ea0d9f68ac1"
48
41
) ;
49
42
} ) ;
50
43
51
- before ( "Generate data for prepareUpdate" , ( ) => {
44
+ beforeAll ( ( ) => {
52
45
// Create a state that has as nextSyncCommittee the committee 2
53
46
const finalizedBlockSlot = SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD + 1 ;
54
47
const headerBlockSlot = finalizedBlockSlot + 1 ;
@@ -107,6 +100,6 @@ describe("syncInMemory", function () {
107
100
} ,
108
101
} ;
109
102
110
- expect ( ( ) => processLightClientUpdate ( config , store , update , currentSlot ) ) . to . not . throw ( ) ;
103
+ expect ( ( ) => processLightClientUpdate ( config , store , update , currentSlot ) ) . not . toThrow ( ) ;
111
104
} ) ;
112
105
} ) ;
0 commit comments