Don't persist BFT proposed blocks, only committed ones (#7204)

* Don't persist BFT proposed blocks, only committed ones

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

* Fix unit tests, update copyright

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

* Update changelog

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

---------

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
Signed-off-by: Matt Whitehead <matthew.whitehead@kaleido.io>
pull/7228/head
Matt Whitehead 6 months ago committed by GitHub
parent c8d01075e7
commit c52975b275
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 4
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/validation/ProposalPayloadValidator.java
  3. 18
      consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/validation/ProposalPayloadValidatorTest.java
  4. 8
      consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/validation/ProposalValidatorTest.java

@ -30,6 +30,8 @@
### Bug fixes
- Make `eth_gasPrice` aware of the base fee market [#7102](https://github.com/hyperledger/besu/pull/7102)
- Validation errors ignored in accounts-allowlist and empty list [#7138](https://github.com/hyperledger/besu/issues/7138)
- Fix "Invalid block detected" for BFT chains using Bonsai DB [#7204](https://github.com/hyperledger/besu/pull/7204)
## 24.5.2
### Upcoming Breaking Changes

@ -1,5 +1,5 @@
/*
* Copyright 2020 ConsenSys AG.
* Copyright contributors to Hyperledger Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@ -150,7 +150,7 @@ public class ProposalPayloadValidator {
final var validationResult =
blockValidator.validateAndProcessBlock(
protocolContext, block, HeaderValidationMode.LIGHT, HeaderValidationMode.FULL);
protocolContext, block, HeaderValidationMode.LIGHT, HeaderValidationMode.FULL, false);
if (!validationResult.isSuccessful()) {
LOG.info(

@ -105,7 +105,8 @@ public class ProposalPayloadValidatorTest {
eq(protocolContext),
eq(block),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult(Optional.empty()));
assertThat(payloadValidator.validate(proposal.getSignedPayload())).isTrue();
@ -129,7 +130,8 @@ public class ProposalPayloadValidatorTest {
eq(protocolContext),
eq(block),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult(Optional.empty()));
assertThat(payloadValidator.validate(proposal.getSignedPayload())).isTrue();
@ -152,7 +154,8 @@ public class ProposalPayloadValidatorTest {
eq(protocolContext),
eq(block),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult("Failed"));
assertThat(payloadValidator.validate(proposal.getSignedPayload())).isFalse();
@ -228,7 +231,8 @@ public class ProposalPayloadValidatorTest {
eq(protocolContext),
eq(block),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult(Optional.empty()));
assertThat(payloadValidator.validate(proposal.getSignedPayload())).isFalse();
@ -262,7 +266,8 @@ public class ProposalPayloadValidatorTest {
eq(protocolContext),
eq(block),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult(Optional.empty()));
when(cmsValidator.validate(eq(cms), eq(hashWithoutCms))).thenReturn(false);
@ -297,7 +302,8 @@ public class ProposalPayloadValidatorTest {
eq(protocolContext),
eq(block),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult(Optional.empty()));
when(cmsValidator.validate(eq(cms), eq(hashWithoutCms))).thenReturn(true);

@ -1,5 +1,5 @@
/*
* Copyright 2020 ConsenSys AG.
* Copyright contributors to Hyperledger Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@ -111,7 +111,8 @@ public class ProposalValidatorTest {
eq(protocolContext),
any(),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult(Optional.empty()));
when(protocolSchedule.getByBlockHeader(any())).thenReturn(protocolSpec);
@ -168,7 +169,8 @@ public class ProposalValidatorTest {
eq(protocolContext),
any(),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult("Failed"));
assertThat(roundItem.messageValidator.validate(proposal)).isFalse();

Loading…
Cancel
Save