diff --git a/choam/src/main/java/com/salesforce/apollo/choam/GenesisAssembly.java b/choam/src/main/java/com/salesforce/apollo/choam/GenesisAssembly.java index cdcb732dd..a5ee566f6 100644 --- a/choam/src/main/java/com/salesforce/apollo/choam/GenesisAssembly.java +++ b/choam/src/main/java/com/salesforce/apollo/choam/GenesisAssembly.java @@ -106,12 +106,12 @@ public GenesisAssembly(ViewContext vc, CommonCommunications 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( @@ -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; diff --git a/choam/src/main/java/com/salesforce/apollo/choam/ViewAssembly.java b/choam/src/main/java/com/salesforce/apollo/choam/ViewAssembly.java index 238f92f46..c6b854426 100644 --- a/choam/src/main/java/com/salesforce/apollo/choam/ViewAssembly.java +++ b/choam/src/main/java/com/salesforce/apollo/choam/ViewAssembly.java @@ -424,6 +424,7 @@ public void checkAssembly() { } public void checkViews() { + countdown.set(-1); vote(); } @@ -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(); diff --git a/choam/src/main/java/com/salesforce/apollo/choam/fsm/Reconfiguration.java b/choam/src/main/java/com/salesforce/apollo/choam/fsm/Reconfiguration.java index c76a2492d..41532259b 100644 --- a/choam/src/main/java/com/salesforce/apollo/choam/fsm/Reconfiguration.java +++ b/choam/src/main/java/com/salesforce/apollo/choam/fsm/Reconfiguration.java @@ -23,6 +23,8 @@ public interface Reconfiguration { void complete(); + void convened(); + void failed(); void finish(); @@ -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 @@ -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() { @@ -157,12 +180,13 @@ public Transitions viewAcquired() { return GATHER; } - // no op+ + // no op @Override public Transitions proposed() { return null; } } + } interface Transitions extends FsmExecutor {