File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,19 +238,24 @@ describe("SortitionTree", () => {
238238
239239 describe ( "trunk stacks" , async ( ) => {
240240 it ( "works as expected" , async ( ) => {
241+ // inserted in the first position
241242 await sortition . publicInsertOperator ( alice . address , 0x1234 )
243+ // inserted in the second position
242244 await sortition . publicInsertOperator ( bob . address , 0x9876 )
243245
244246 await sortition . publicRemoveOperator ( alice . address )
245247 const deletedLeaf = await sortition . getLeaf ( 0x00000 )
246248 expect ( deletedLeaf ) . to . be . equal ( 0 )
247249
250+ // the first position isn't reused until we've inserted 8^7 = 2097152
251+ // operators. Alice is inserted in the third position.
248252 await sortition . publicInsertOperator ( alice . address , 0xdead )
249253
250254 const stillDeletedLeaf = await sortition . getLeaf ( 0x00000 )
251255 expect ( stillDeletedLeaf ) . to . be . equal ( 0 )
252256
253257 const root = await sortition . getRoot ( )
258+ // 0x9876 + 0xdead = 0x17723
254259 expect ( ethers . utils . hexlify ( root ) ) . to . be . equal ( "0x017723" )
255260 } )
256261 } )
You can’t perform that action at this time.
0 commit comments