make getRoot return next session if possible

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2026-07-26 22:22:34 +03:00
parent f9015bf9a5
commit 412185b667
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
2 changed files with 7 additions and 1 deletions

View File

@ -69,7 +69,12 @@ abstract contract Weaver is IWeaver {
} }
} }
return (currentLevel[0], _filledEntries[session]); uint256 nextSession = session;
if (nextSession < currentSession) {
unchecked { ++nextSession; }
}
return (currentLevel[0], nextSession);
} }
function getProof( function getProof(

View File

@ -173,6 +173,7 @@ contract GatekeeperWeaverTest is Test {
assertEq(gatekeeper.slotLengths(session + 1, 0), 1); assertEq(gatekeeper.slotLengths(session + 1, 0), 1);
assertEq(prevEntries, gatekeeper.ENTRIES()); assertEq(prevEntries, gatekeeper.ENTRIES());
assertEq(gatekeeper.filledEntries(session + 1), 1); assertEq(gatekeeper.filledEntries(session + 1), 1);
assertEq(session + 1, gatekeeper.currentSession());
session += 1; session += 1;
previousHash = bytes32(0); previousHash = bytes32(0);