Skip to content

Commit

Permalink
p-crowns (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer authored Nov 20, 2023
1 parent bf11dc1 commit 8b8e545
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions choam/src/main/java/com/salesforce/apollo/choam/CHOAM.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public CHOAM(Parameters params) {
session = new Session(params, service());
}

public static Checkpoint checkpoint(DigestAlgorithm algo, File state, int segmentSize, Digest initial) {
public static Checkpoint checkpoint(DigestAlgorithm algo, File state, int segmentSize, Digest initial, int crowns) {
assert segmentSize > 0 : "segment size must be > 0 : " + segmentSize;
long length = 0;
if (state != null) {
Expand All @@ -145,7 +145,7 @@ public static Checkpoint checkpoint(DigestAlgorithm algo, File state, int segmen
if (length != 0 && count * segmentSize < length) {
count++;
}
var accumulator = new HexBloom.HexAccumulator(count, 2, initial);
var accumulator = new HexBloom.HexAccumulator(count, crowns, initial);
Checkpoint.Builder builder = Checkpoint.newBuilder()
.setCount(count)
.setByteSize(length)
Expand Down Expand Up @@ -386,7 +386,8 @@ private Block checkpoint() {
return null;
}
final HashedBlock c = checkpoint.get();
Checkpoint cp = checkpoint(params.digestAlgorithm(), state, params.checkpointSegmentSize(), c.hash);
Checkpoint cp = checkpoint(params.digestAlgorithm(), state, params.checkpointSegmentSize(), c.hash,
params.crowns());
if (cp == null) {
transitions.fail();
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private HashedCertifiedBlock checkpointBlock() {
CHOAM.checkpoint(
DigestAlgorithm.DEFAULT,
null, 1,
checkpoint.hash))
checkpoint.hash, 2))
.build())
.build());
store.put(lastBlock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.salesfoce.apollo.choam.proto.CheckpointSegments;
import com.salesfoce.apollo.choam.proto.Slice;
import com.salesforce.apollo.archipelago.RouterImpl.CommonCommunications;
import com.salesforce.apollo.bloomFilters.BloomFilter;
import com.salesforce.apollo.choam.CHOAM;
import com.salesforce.apollo.choam.comm.Concierge;
import com.salesforce.apollo.choam.comm.Terminal;
Expand All @@ -25,7 +26,6 @@
import com.salesforce.apollo.stereotomy.mem.MemKERL;
import com.salesforce.apollo.stereotomy.mem.MemKeyStore;
import com.salesforce.apollo.utils.Utils;
import com.salesforce.apollo.bloomFilters.BloomFilter;
import org.h2.mvstore.MVStore;
import org.joou.ULong;
import org.junit.jupiter.api.AfterEach;
Expand Down Expand Up @@ -94,7 +94,8 @@ public void functional() throws Exception {
.toList();
members.forEach(m -> context.activate(m));

Checkpoint checkpoint = CHOAM.checkpoint(DigestAlgorithm.DEFAULT, chkptFile, SEGMENT_SIZE, DigestAlgorithm.DEFAULT.getOrigin());
Checkpoint checkpoint = CHOAM.checkpoint(DigestAlgorithm.DEFAULT, chkptFile, SEGMENT_SIZE,
DigestAlgorithm.DEFAULT.getOrigin(), 2);

SigningMember bootstrapping = members.get(0);

Expand Down

0 comments on commit 8b8e545

Please sign in to comment.