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

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

Merged
merged 10 commits into from
Jun 13, 2024
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -150,7 +150,7 @@ private boolean validateBlock(final Block block) {

final var validationResult =
blockValidator.validateAndProcessBlock(
protocolContext, block, HeaderValidationMode.LIGHT, HeaderValidationMode.FULL);
protocolContext, block, HeaderValidationMode.LIGHT, HeaderValidationMode.FULL, false);

if (!validationResult.isSuccessful()) {
LOG.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public void validationPassesWhenProposerAndRoundMatchAndBlockIsValid() {
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();
Expand All @@ -129,7 +130,8 @@ public void validationPassesWhenBlockRoundDoesNotMatchProposalRound() {
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();
Expand All @@ -152,7 +154,8 @@ public void validationFailsWhenBlockFailsValidation() {
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();
Expand Down Expand Up @@ -228,7 +231,8 @@ public void validationFailsForBlockWithIncorrectHeight() {
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();
Expand Down Expand Up @@ -262,7 +266,8 @@ public void validationForCmsFailsWhenCmsFailsValidation() {
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);

Expand Down Expand Up @@ -297,7 +302,8 @@ public void validationForCmsPassesWhenCmsIsValid() {
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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -111,7 +111,8 @@ QbftContext.class, emptyList(), bftExtraDataEncoder),
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);
Expand Down Expand Up @@ -168,7 +169,8 @@ public void validationFailsIfBlockIsInvalid() {
eq(protocolContext),
any(),
eq(HeaderValidationMode.LIGHT),
eq(HeaderValidationMode.FULL)))
eq(HeaderValidationMode.FULL),
eq(false)))
.thenReturn(new BlockProcessingResult("Failed"));

assertThat(roundItem.messageValidator.validate(proposal)).isFalse();
Expand Down
Loading