Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions boot.tests/ShareAttributionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,23 @@ public void FullReserveImportAllowsOneSnapshotContextPerBoundedProof()
Assert.IsTrue(BootProtocolStateService.GetMaxImportedSnapshotContextCount(config) >= 396);
}

[TestMethod]
public void FreshProductionPlaceholderDoesNotEnterSiblingReconciliation()
{
Assert.IsFalse(BootProtocolStateService.ShouldReconcileSnapshotFamily(
hasLocalActiveFamily: true,
localStateIsEmpty: true,
allowEmptySnapshotBootstrap: false));
Assert.IsTrue(BootProtocolStateService.ShouldReconcileSnapshotFamily(
hasLocalActiveFamily: true,
localStateIsEmpty: false,
allowEmptySnapshotBootstrap: false));
Assert.IsTrue(BootProtocolStateService.ShouldReconcileSnapshotFamily(
hasLocalActiveFamily: true,
localStateIsEmpty: true,
allowEmptySnapshotBootstrap: true));
}

[TestMethod]
public async Task RegtestSiblingImportAcceptsProofRecordedAgainstExplicitEmptyBootstrapSnapshotAsync()
{
Expand Down
14 changes: 12 additions & 2 deletions boot_portal/Services/BootProtocolStateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4659,8 +4659,10 @@ public async Task<bool> TryAdoptCurrentStateAsync(BootStateBundle bundle, string
}
if (GetActiveConsensusVersion() >= BootProtocolVersions.ConsensusVersion &&
bundle.SnapshotFamilyMember != null &&
hasLocalActiveFamily &&
(!localStateIsEmpty || _poolConfig.AllowEmptySnapshotBootstrap))
ShouldReconcileSnapshotFamily(
hasLocalActiveFamily,
localStateIsEmpty,
_poolConfig.AllowEmptySnapshotBootstrap))
{
return await TryReconcileSiblingSnapshotAsync(
bundle,
Expand Down Expand Up @@ -6370,6 +6372,14 @@ internal static int GetMaxImportedSnapshotContextCount(PoolConfig config)
return config.SnapshotProofSlotCount + config.WorkSetReserveLimit + 2;
}

internal static bool ShouldReconcileSnapshotFamily(
bool hasLocalActiveFamily,
bool localStateIsEmpty,
bool allowEmptySnapshotBootstrap)
{
return hasLocalActiveFamily && (!localStateIsEmpty || allowEmptySnapshotBootstrap);
}

private int RepairMissingWorkSetSnapshotContextsNoLock(DateTime nowUtc)
{
HashSet<string> existingContextIds = _state.SnapshotContexts
Expand Down
Loading