Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entropy #207

Merged
merged 22 commits into from
Jun 7, 2024
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
249 changes: 149 additions & 100 deletions choam/src/main/java/com/salesforce/apollo/choam/CHOAM.java

Large diffs are not rendered by default.

28 changes: 12 additions & 16 deletions choam/src/main/java/com/salesforce/apollo/choam/Producer.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public boolean complete() {
}

public void join(SignedViewMember viewMember) {
assembly.join(viewMember, true);
assembly.joined(viewMember);
}

public void start() {
Expand Down Expand Up @@ -234,7 +234,7 @@ private Parameters params() {

private void processAssemblies(List<UnitData> aggregate) {
var aggs = aggregate.stream().flatMap(e -> e.getAssembliesList().stream()).toList();
log.trace("Consuming {} assemblies from {} units on: {}", aggs.size(), aggregate.size(),
log.trace("Consuming: {} assemblies from: {} units on: {}", aggs.size(), aggregate.size(),
params().member().getId());
assembly.assemble(aggs);
}
Expand Down Expand Up @@ -313,14 +313,14 @@ private void publish(PendingBlock p) {
}

private void publish(PendingBlock p, boolean beacon) {
assert p.witnesses.size() >= params().majority() : "Publishing non majority block";
assert p.witnesses.size() >= params().majority() : "Attempt to publish non majority block";
var publish = p.published.compareAndSet(false, true);
if (!publish && !beacon) {
log.trace("Already published: {} hash: {} height: {} witnesses: {} on: {}", p.block.block.getBodyCase(),
p.block.hash, p.block.height(), p.witnesses.values().size(), params().member().getId());
return;
}
log.trace("Publishing {}pending: {} hash: {} height: {} witnesses: {} on: {}", beacon ? "(beacon) " : "",
log.trace("Publishing {}: {} hash: {} height: {} witnesses: {} on: {}", beacon ? "(beacon) " : "(pending)",
p.block.block.getBodyCase(), p.block.hash, p.block.height(), p.witnesses.values().size(),
params().member().getId());
final var cb = CertifiedBlock.newBuilder()
Expand Down Expand Up @@ -357,21 +357,22 @@ private void reconfigure() {
}

private void serial(List<ByteString> preblock, Boolean last) {
try {
serialize.acquire();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
Thread.ofVirtual().start(() -> {
try {
serialize.acquire();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
try {
transitions.create(preblock, last);
create(preblock, last);
} catch (Throwable t) {
log.error("Error processing preblock last: {} on: {}", last, params().member().getId(), t);
} finally {
serialize.release();
}
});

}

private PendingBlock validate(Validate v) {
Expand Down Expand Up @@ -436,11 +437,6 @@ public void complete() {
stop();
}

@Override
public void create(List<ByteString> preblock, boolean last) {
Producer.this.create(preblock, last);
}

@Override
public void fail() {
stop();
Expand Down
Loading
Loading