Skip to content

Commit 58bc5d8

Browse files
author
Beau Shinkle
committed
Annotate trunk stacks
1 parent db536bb commit 58bc5d8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

test/sortitionTreeTest.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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
})

0 commit comments

Comments
 (0)