Fix: test for correct verify root in slot builder.

This commit is contained in:
benbierens 2024-01-16 15:45:23 +01:00 committed by Dmitriy Ryajov
parent 9c1ea719d8
commit 964fe47ea2
2 changed files with 9 additions and 1 deletions

View File

@ -354,6 +354,14 @@ proc new*(
error "Failed to build slot roots tree", err = err.msg
return failure(err)
without expectedRoot =? manifest.verifyRoot.fromVerifyCid(), err:
error "Unable to convert manifest verifyRoot to hash", error = err.msg
return failure(err)
if verifyRoot =? tree.root:
if verifyRoot != expectedRoot:
return failure "Existing slots root doesn't match reconstructed root."
self.slotRoots = slotRoots
self.verifyTree = some tree

View File

@ -361,7 +361,7 @@ suite "Slot builder":
verifyManifest,
cellSize = cellSize).isErr
test "Should not build from verifiable manifest with slots root":
test "Should not build from verifiable manifest with invalid verify root":
let
slotBuilder = SlotsBuilder.new(
localStore,