Skip to content

Commit

Permalink
moar logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer committed Dec 26, 2023
1 parent 21a392a commit 60f7d0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions thoth/src/main/java/com/salesforce/apollo/thoth/Ani.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public class Ani {

private static final Logger log = LoggerFactory.getLogger(Ani.class);

private final Digest id;
private final Digest member;
private final KERL kerl;

public Ani(Digest id, KERL kerl) {
this.id = id;
public Ani(Digest member, KERL kerl) {
this.member = member;
this.kerl = kerl;
}

Expand All @@ -51,30 +51,34 @@ public EventValidation eventValidation(Duration timeout) {
@Override
public Filtered filtered(EventCoordinates coordinates, SigningThreshold threshold, JohnHancock signature,
InputStream message) {

log.trace("Filtering for: {} on: {}", coordinates, member);
KeyState ks = kerl.getKeyState(coordinates);
var v = new Verifier.DefaultVerifier(ks.getKeys());
return v.filtered(threshold, signature, message);
}

@Override
public Optional<KeyState> getKeyState(EventCoordinates coordinates) {
log.trace("Get key state: {} on: {}", coordinates, member);
return Optional.of(kerl.getKeyState(coordinates));
}

@Override
public boolean validate(EstablishmentEvent event) {
log.trace("Validate event: {} on: {}", event, member);
return Ani.this.validateKerl(event, timeout);
}

@Override
public boolean validate(EventCoordinates coordinates) {
log.trace("Validating coordinates: {} on: {}", coordinates, member);
KeyEvent ke = kerl.getKeyEvent(coordinates);
return Ani.this.validateKerl(ke, timeout);
}

@Override
public boolean verify(EventCoordinates coordinates, JohnHancock signature, InputStream message) {
log.trace("Verify coordinates: {} on: {}", coordinates, member);
KeyState ks = kerl.getKeyState(coordinates);
var v = new Verifier.DefaultVerifier(ks.getKeys());
return v.verify(signature, message);
Expand All @@ -83,6 +87,7 @@ public boolean verify(EventCoordinates coordinates, JohnHancock signature, Input
@Override
public boolean verify(EventCoordinates coordinates, SigningThreshold threshold, JohnHancock signature,
InputStream message) {
log.trace("Verify coordinates: {} on: {}", coordinates, member);
KeyState ks = kerl.getKeyState(coordinates);
var v = new Verifier.DefaultVerifier(ks.getKeys());
return v.verify(threshold, signature, message);
Expand Down Expand Up @@ -134,6 +139,7 @@ private boolean kerlValidate(Duration timeout, KeyStateWithAttachments ksa, KeyE
event.toKeyEvent_()
.toByteString()));
}
log.trace("Kerl validation: {} for: {} on: {}", witnessed, ksa.state().getCoordinates(), member);
return witnessed;
}

Expand All @@ -146,5 +152,4 @@ private boolean performKerlValidation(EventCoordinates coord, Duration timeout)
private boolean validateKerl(KeyEvent event, Duration timeout) {
return performKerlValidation(event.getCoordinates(), timeout);
}

}
1 change: 1 addition & 0 deletions thoth/src/main/java/com/salesforce/apollo/thoth/Maat.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public Maat(Context<Member> context, KERL delegate, KERL validators) {

@Override
public KeyState append(KeyEvent event) {
log.trace("Append: {}", event);
var l = append(Collections.singletonList(event), Collections.emptyList());
return l.isEmpty() ? null : l.get(0);
}
Expand Down

0 comments on commit 60f7d0c

Please sign in to comment.