@@ -153,6 +153,61 @@ func TestTwoQuorums(t *testing.T) {
153
153
}
154
154
}
155
155
156
+ func TestTwoQuorumsReverseOrder (t * testing.T ) {
157
+
158
+ stakes := map [core.QuorumID ]map [core.OperatorID ]int {
159
+ 1 : {
160
+ mock .MakeOperatorId (0 ): 1 ,
161
+ mock .MakeOperatorId (1 ): 10 ,
162
+ mock .MakeOperatorId (2 ): 1 ,
163
+ mock .MakeOperatorId (3 ): 1 ,
164
+ mock .MakeOperatorId (4 ): 3 ,
165
+ },
166
+ 0 : {
167
+ mock .MakeOperatorId (0 ): 2 ,
168
+ mock .MakeOperatorId (1 ): 1 ,
169
+ mock .MakeOperatorId (2 ): 10 ,
170
+ mock .MakeOperatorId (3 ): 1 ,
171
+ },
172
+ }
173
+
174
+ dat , err := mock .NewChainDataMock (stakes )
175
+ assert .NoError (t , err )
176
+
177
+ state := dat .GetTotalOperatorState (context .Background (), 0 )
178
+
179
+ assignmentsBothQuorums , err := corev2 .GetAssignmentsForBlob (state .OperatorState , blobParams , []core.QuorumID {0 , 1 })
180
+ assert .NoError (t , err )
181
+ assert .Len (t , assignmentsBothQuorums , 5 )
182
+
183
+ assignmentsQuorum0 , err := corev2 .GetAssignmentsForBlob (state .OperatorState , blobParams , []core.QuorumID {1 })
184
+ assert .NoError (t , err )
185
+ assert .Len (t , assignmentsQuorum0 , 5 )
186
+
187
+ assignmentsQuorum1 , err := corev2 .GetAssignmentsForBlob (state .OperatorState , blobParams , []core.QuorumID {0 })
188
+ assert .NoError (t , err )
189
+ assert .Len (t , assignmentsQuorum1 , 4 )
190
+
191
+ // Check that the length of the assignment for each operator is equal to the maximum of the assignments for that operator in each quorum
192
+ for id := range assignmentsBothQuorums {
193
+
194
+ // Get the bigger assignemnt between the two quorums
195
+ maxChunks := uint32 (0 )
196
+ assignment , ok := assignmentsQuorum0 [id ]
197
+ if ok {
198
+ maxChunks = assignment .NumChunks ()
199
+ }
200
+ assignment , ok = assignmentsQuorum1 [id ]
201
+ if ok {
202
+ if assignment .NumChunks () > maxChunks {
203
+ maxChunks = assignment .NumChunks ()
204
+ }
205
+ }
206
+ fmt .Println (id , assignmentsBothQuorums [id ].NumChunks (), maxChunks )
207
+ assert .LessOrEqual (t , assignmentsBothQuorums [id ].NumChunks (), maxChunks )
208
+ }
209
+ }
210
+
156
211
func TestManyQuorums (t * testing.T ) {
157
212
158
213
testCases := []uint8 {1 , 2 , 3 , 4 , 5 , 10 , 15 , 20 , 50 , 100 , 200 , 255 }
0 commit comments