@@ -3,14 +3,14 @@ import {assert} from "chai";
3
3
import { SLOTS_PER_EPOCH } from "@chainsafe/lodestar-params" ;
4
4
import { isSlashableAttestationData } from "../../../src/util" ;
5
5
import { randBetween } from "../../utils/misc" ;
6
- import { generateAttestationDataBn } from "../../utils/attestation" ;
6
+ import { generateAttestationDataBigint } from "../../utils/attestation" ;
7
7
8
8
describe ( "isSlashableAttestationData" , ( ) => {
9
9
it ( "Attestation data with the same target epoch should return true" , ( ) => {
10
10
const epoch1 = randBetween ( 1 , 1000 ) ;
11
11
const epoch2 = epoch1 + 1 ;
12
- const a1 = generateAttestationDataBn ( epoch1 , epoch2 ) ;
13
- const a2 = generateAttestationDataBn ( epoch1 - 1 , epoch2 ) ;
12
+ const a1 = generateAttestationDataBigint ( epoch1 , epoch2 ) ;
13
+ const a2 = generateAttestationDataBigint ( epoch1 - 1 , epoch2 ) ;
14
14
assert . isTrue ( isSlashableAttestationData ( a1 , a2 ) ) ;
15
15
} ) ;
16
16
@@ -19,8 +19,8 @@ describe("isSlashableAttestationData", () => {
19
19
const epoch2 = epoch1 + 1 ;
20
20
const epoch3 = epoch1 + 2 ;
21
21
const epoch4 = epoch1 + 3 ;
22
- const a1 = generateAttestationDataBn ( epoch1 , epoch2 ) ;
23
- const a2 = generateAttestationDataBn ( epoch3 , epoch4 ) ;
22
+ const a1 = generateAttestationDataBigint ( epoch1 , epoch2 ) ;
23
+ const a2 = generateAttestationDataBigint ( epoch3 , epoch4 ) ;
24
24
assert . isFalse ( isSlashableAttestationData ( a1 , a2 ) ) ;
25
25
} ) ;
26
26
@@ -32,14 +32,14 @@ describe("isSlashableAttestationData", () => {
32
32
const targetEpoch1 = randBetween ( 1 , 1000 ) ;
33
33
const targetEpoch2 = targetEpoch1 - 1 ;
34
34
35
- const a1 = generateAttestationDataBn ( sourceEpoch1 , targetEpoch1 ) ;
36
- const a2Hi = generateAttestationDataBn ( sourceEpoch2Hi , targetEpoch2 ) ;
35
+ const a1 = generateAttestationDataBigint ( sourceEpoch1 , targetEpoch1 ) ;
36
+ const a2Hi = generateAttestationDataBigint ( sourceEpoch2Hi , targetEpoch2 ) ;
37
37
38
38
assert . isFalse ( isSlashableAttestationData ( a1 , a2Hi ) ) ;
39
39
40
40
// Second attestation has a smaller source epoch.
41
41
const sourceEpoch2Lo = sourceEpoch1 - 1 ;
42
- const a2Lo = generateAttestationDataBn ( sourceEpoch2Lo , targetEpoch2 ) ;
42
+ const a2Lo = generateAttestationDataBigint ( sourceEpoch2Lo , targetEpoch2 ) ;
43
43
assert . isFalse ( isSlashableAttestationData ( a1 , a2Lo ) ) ;
44
44
} ) ;
45
45
@@ -55,16 +55,16 @@ describe("isSlashableAttestationData", () => {
55
55
// First slot in the epoch
56
56
let targetSlot2 = ( targetEpoch - 1 ) * SLOTS_PER_EPOCH ;
57
57
58
- let a1 = generateAttestationDataBn ( targetSlot1 , sourceEpoch1 ) ;
59
- let a2 = generateAttestationDataBn ( targetSlot2 , sourceEpoch2 ) ;
58
+ let a1 = generateAttestationDataBigint ( targetSlot1 , sourceEpoch1 ) ;
59
+ let a2 = generateAttestationDataBigint ( targetSlot2 , sourceEpoch2 ) ;
60
60
61
61
assert . isFalse ( isSlashableAttestationData ( a1 , a2 ) ) ;
62
62
63
63
// Second attestation has a greater target epoch.
64
64
targetSlot1 = targetEpoch * SLOTS_PER_EPOCH ;
65
65
targetSlot2 = ( targetEpoch + 1 ) * SLOTS_PER_EPOCH ;
66
- a1 = generateAttestationDataBn ( targetSlot1 , sourceEpoch1 ) ;
67
- a2 = generateAttestationDataBn ( targetSlot2 , sourceEpoch2 ) ;
66
+ a1 = generateAttestationDataBigint ( targetSlot1 , sourceEpoch1 ) ;
67
+ a2 = generateAttestationDataBigint ( targetSlot2 , sourceEpoch2 ) ;
68
68
assert . isFalse ( isSlashableAttestationData ( a1 , a2 ) ) ;
69
69
} ) ;
70
70
} ) ;
0 commit comments