@@ -40,22 +40,22 @@ var (
40
40
},
41
41
}
42
42
att1_1 = & solid.Attestation {
43
- AggregationBits : solid .BitlistFromBytes ([]byte {0b00000001 , 0 , 0 , 0 }, 2048 ),
43
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b00000011 }, 2048 ),
44
44
Data : attData1 ,
45
45
Signature : [96 ]byte {'a' , 'b' , 'c' , 'd' , 'e' , 'f' },
46
46
}
47
47
att1_2 = & solid.Attestation {
48
- AggregationBits : solid .BitlistFromBytes ([]byte {0b00000001 , 0 , 0 , 0 }, 2048 ),
48
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b00000011 }, 2048 ),
49
49
Data : attData1 ,
50
50
Signature : [96 ]byte {'d' , 'e' , 'f' , 'g' , 'h' , 'i' },
51
51
}
52
52
att1_3 = & solid.Attestation {
53
- AggregationBits : solid .BitlistFromBytes ([]byte {0b00000100 , 0 , 0 , 0 }, 2048 ),
53
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b00001100 }, 2048 ),
54
54
Data : attData1 ,
55
55
Signature : [96 ]byte {'g' , 'h' , 'i' , 'j' , 'k' , 'l' },
56
56
}
57
57
att1_4 = & solid.Attestation {
58
- AggregationBits : solid .BitlistFromBytes ([]byte {0b00100000 , 0 , 0 , 0 }, 2048 ),
58
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b01100000 }, 2048 ),
59
59
Data : attData1 ,
60
60
Signature : [96 ]byte {'m' , 'n' , 'o' , 'p' , 'q' , 'r' },
61
61
}
72
72
},
73
73
}
74
74
att2_1 = & solid.Attestation {
75
- AggregationBits : solid .BitlistFromBytes ([]byte {0b00000001 , 0 , 0 , 0 }, 2048 ),
75
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b00000001 }, 2048 ),
76
76
Data : attData2 ,
77
77
Signature : [96 ]byte {'t' , 'e' , 's' , 't' , 'i' , 'n' },
78
78
}
@@ -107,21 +107,21 @@ func (t *PoolTestSuite) TearDownTest() {
107
107
108
108
func (t * PoolTestSuite ) TestAddAttestationElectra () {
109
109
cBits1 := solid .NewBitVector (64 )
110
- cBits1 .SetBitAt (0 , true )
110
+ cBits1 .SetBitAt (10 , true )
111
111
cBits2 := solid .NewBitVector (64 )
112
112
cBits2 .SetBitAt (10 , true )
113
113
expectedCommitteeBits := solid .NewBitVector (64 )
114
- expectedCommitteeBits .SetBitAt (0 , true )
114
+ expectedCommitteeBits .SetBitAt (10 , true )
115
115
expectedCommitteeBits .SetBitAt (10 , true )
116
116
117
117
att1 := & solid.Attestation {
118
- AggregationBits : solid .BitlistFromBytes ([]byte {0b00000001 , 0 , 0 , 0 }, 2048 * 64 ),
118
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b00000011 }, 2048 * 64 ),
119
119
Data : attData1 ,
120
120
Signature : [96 ]byte {'a' , 'b' , 'c' , 'd' , 'e' , 'f' },
121
121
CommitteeBits : cBits1 ,
122
122
}
123
123
att2 := & solid.Attestation {
124
- AggregationBits : solid .BitlistFromBytes ([]byte {0b00000000 , 0b00001000 , 0 , 0 }, 2048 * 64 ),
124
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b00001100 }, 2048 * 64 ),
125
125
Data : attData1 ,
126
126
Signature : [96 ]byte {'d' , 'e' , 'f' , 'g' , 'h' , 'i' },
127
127
CommitteeBits : cBits2 ,
@@ -141,11 +141,11 @@ func (t *PoolTestSuite) TestAddAttestationElectra() {
141
141
},
142
142
hashRoot : attData1Root ,
143
143
mockFunc : func () {
144
- t .mockEthClock .EXPECT ().GetEpochAtSlot (gomock .Any ()).Return (uint64 (1 )).Times (1 )
145
- t .mockEthClock .EXPECT ().StateVersionByEpoch (gomock .Any ()).Return (clparams .ElectraVersion ).Times (1 )
144
+ t .mockEthClock .EXPECT ().GetEpochAtSlot (gomock .Any ()).Return (uint64 (1 )).Times (2 )
145
+ t .mockEthClock .EXPECT ().StateVersionByEpoch (gomock .Any ()).Return (clparams .ElectraVersion ).Times (2 )
146
146
},
147
147
expect : & solid.Attestation {
148
- AggregationBits : solid .BitlistFromBytes ([]byte {0b0000001 , 0b00001000 , 0 , 0 }, 2048 * 64 ),
148
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b00001101 }, 2048 * 64 ),
149
149
Data : attData1 ,
150
150
Signature : mockAggrResult ,
151
151
CommitteeBits : expectedCommitteeBits ,
@@ -162,9 +162,7 @@ func (t *PoolTestSuite) TestAddAttestationElectra() {
162
162
for i := range tc .atts {
163
163
pool .AddAttestation (tc .atts [i ])
164
164
}
165
- att := pool .GetAggregatationByRoot (tc .hashRoot )
166
- //h1, _ := tc.expect.HashSSZ()
167
- //h2, _ := att.HashSSZ()
165
+ att := pool .GetAggregatationByRootAndCommittee (tc .hashRoot , 10 )
168
166
t .Equal (tc .expect , att , tc .name )
169
167
}
170
168
}
@@ -184,7 +182,11 @@ func (t *PoolTestSuite) TestAddAttestation() {
184
182
att2_1 ,
185
183
},
186
184
hashRoot : attData1Root ,
187
- expect : att1_1 ,
185
+ mockFunc : func () {
186
+ t .mockEthClock .EXPECT ().GetEpochAtSlot (gomock .Any ()).Return (uint64 (1 )).AnyTimes ()
187
+ t .mockEthClock .EXPECT ().StateVersionByEpoch (gomock .Any ()).Return (clparams .DenebVersion ).AnyTimes ()
188
+ },
189
+ expect : att1_1 ,
188
190
},
189
191
{
190
192
name : "att1_2 is a super set of att1_1. skip att1_1" ,
@@ -194,7 +196,11 @@ func (t *PoolTestSuite) TestAddAttestation() {
194
196
att2_1 , // none of its business
195
197
},
196
198
hashRoot : attData1Root ,
197
- expect : att1_2 ,
199
+ mockFunc : func () {
200
+ t .mockEthClock .EXPECT ().GetEpochAtSlot (gomock .Any ()).Return (uint64 (1 )).AnyTimes ()
201
+ t .mockEthClock .EXPECT ().StateVersionByEpoch (gomock .Any ()).Return (clparams .DenebVersion ).AnyTimes ()
202
+ },
203
+ expect : att1_2 ,
198
204
},
199
205
{
200
206
name : "merge att1_2, att1_3, att1_4" ,
@@ -209,7 +215,7 @@ func (t *PoolTestSuite) TestAddAttestation() {
209
215
t .mockEthClock .EXPECT ().StateVersionByEpoch (gomock .Any ()).Return (clparams .DenebVersion ).AnyTimes ()
210
216
},
211
217
expect : & solid.Attestation {
212
- AggregationBits : solid .BitlistFromBytes ([]byte {0b00100101 , 0 , 0 , 0 }, 2048 ),
218
+ AggregationBits : solid .BitlistFromBytes ([]byte {0b01100101 }, 2048 ),
213
219
Data : attData1 ,
214
220
Signature : mockAggrResult ,
215
221
},
@@ -226,8 +232,6 @@ func (t *PoolTestSuite) TestAddAttestation() {
226
232
pool .AddAttestation (tc .atts [i ])
227
233
}
228
234
att := pool .GetAggregatationByRoot (tc .hashRoot )
229
- //h1, _ := tc.expect.HashSSZ()
230
- //h2, _ := att.HashSSZ()
231
235
t .Equal (tc .expect , att , tc .name )
232
236
}
233
237
}
0 commit comments