Skip to content

Commit

Permalink
use majority certs for Reconfiguration. Add new CONVENE state for vie…
Browse files Browse the repository at this point in the history
…w slate completion
  • Loading branch information
Hellblazer committed Jun 8, 2024
1 parent 0684927 commit 29c83b6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ public GenesisAssembly(ViewContext vc, CommonCommunications<Terminal, ?> comms,

@Override
public void certify() {
if (slate.size() != nextAssembly.size()) {
if (slate.size() < params().majority()) {
log.info("Not certifying genesis for: {} need: {} slate incomplete: {} on: {}", view.context().getId(),
nextAssembly.size(), slate.keySet().stream().sorted().toList(), params().member().getId());
params().majority(), slate.keySet().stream().sorted().toList(), params().member().getId());
return;
}
assert slate.size() == nextAssembly.size() : "Expected: %s members, slate: %s".formatted(nextAssembly.size(),
assert slate.size() >= params().majority() : "Expected: %s members, slate: %s".formatted(params().majority(),
slate.size());
reconfiguration = new HashedBlock(params().digestAlgorithm(), view.genesis(slate, view.context().getId(),
new NullBlock(
Expand Down Expand Up @@ -187,12 +187,12 @@ public void publish() {
log.trace("Cannot publish genesis, reconfiguration is NULL on: {}", params().member().getId());
return;
}
if (witnesses.size() < nextAssembly.size()) {
if (witnesses.size() < params().majority()) {
log.trace("Cannot publish genesis: {} with: {} witnesses on: {}", reconfiguration.hash, witnesses.size(),
params().member().getId());
return;
}
if (reconfiguration.block.getGenesis().getInitialView().getJoinsCount() < nextAssembly.size()) {
if (reconfiguration.block.getGenesis().getInitialView().getJoinsCount() < params().majority()) {
log.trace("Cannot publish genesis: {} with: {} joins on: {}", reconfiguration.hash,
reconfiguration.block.getGenesis().getInitialView().getJoinsCount(), params().member().getId());
return;
Expand Down
10 changes: 10 additions & 0 deletions choam/src/main/java/com/salesforce/apollo/choam/ViewAssembly.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ public void checkAssembly() {
}

public void checkViews() {
countdown.set(-1);
vote();
}

Expand All @@ -442,6 +443,15 @@ public void complete() {
ViewAssembly.this.complete();
}

@Override
public void convened() {
if (viewProposals.size() == params().context().getRingCount()) {
transitions.proposed();
} else {
countdown.set(2);
}
}

@Override
public void failed() {
view.onFailure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public interface Reconfiguration {

void complete();

void convened();

void failed();

void finish();
Expand All @@ -39,11 +41,27 @@ public void publish() {
context().publishViews();
}

// We have a majority of members submitting view proposals
// We have a >= majority submitting view proposals
@Override
public Transitions proposed() {
return CONVIENE;
}
}, CONVIENE {
@Override
public Transitions countdownCompleted() {
return proposed();
}

// We have a >= majority of members submitting view proposals
@Override
public Transitions proposed() {
return VIEW_AGREEMENT;
}

@Entry
public void conviene() {
context().convened();
}
}, CERTIFICATION {
// We have a full complement of the committee view proposals
@Override
Expand Down Expand Up @@ -100,10 +118,15 @@ public Transitions certified() {

@Override
public Transitions checkAssembly() {
context().vibeCheck();
context().checkAssembly();
return null;
}

@Entry
public void vibin() {
context().vibeCheck();
}

// Check to see if we already have a full complement of committee Joins
@Entry
public void chillin() {
Expand Down Expand Up @@ -157,12 +180,13 @@ public Transitions viewAcquired() {
return GATHER;
}

// no op+
// no op
@Override
public Transitions proposed() {
return null;
}
}

}

interface Transitions extends FsmExecutor<Reconfiguration, Transitions> {
Expand Down

0 comments on commit 29c83b6

Please sign in to comment.