From 6dc740e4ec45bc1d1a21f72eb1f059e16beb6a13 Mon Sep 17 00:00:00 2001 From: Stefan Pingel <16143240+pinges@users.noreply.github.com> Date: Thu, 18 Mar 2021 13:24:47 +1000 Subject: [PATCH] fix a problem where the private world state is not found in GoQuorum mode (#2041) * fix #2041 Signed-off-by: Joshua Fernandes --- .../besu/ethereum/goquorum/GoQuorumBlockValidator.java | 6 +++++- .../besu/ethereum/goquorum/GoQuorumPrivateStateUtil.java | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumBlockValidator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumBlockValidator.java index 0d39807458..775e869194 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumBlockValidator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumBlockValidator.java @@ -61,7 +61,11 @@ public class GoQuorumBlockValidator extends MainnetBlockValidator { protected Result processBlock( final ProtocolContext context, final MutableWorldState worldState, final Block block) { final MutableWorldState privateWorldState = - getPrivateWorldState(goQuorumPrivateStorage, goQuorumWorldStateArchive, block.getHeader()); + getPrivateWorldState( + goQuorumPrivateStorage, + goQuorumWorldStateArchive, + worldState.rootHash(), + block.getHash()); return ((GoQuorumBlockProcessor) blockProcessor) .processBlock(context.getBlockchain(), worldState, privateWorldState, block); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumPrivateStateUtil.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumPrivateStateUtil.java index 5d7b32a59d..578ba6ee78 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumPrivateStateUtil.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumPrivateStateUtil.java @@ -37,15 +37,15 @@ public class GoQuorumPrivateStateUtil { goQuorumPrivacyParameters.orElseThrow().privateStorage(); final WorldStateArchive goQuorumWorldStateArchive = goQuorumPrivacyParameters.orElseThrow().worldStateArchive(); - return getPrivateWorldState(goQuorumPrivateStorage, goQuorumWorldStateArchive, header); + return getPrivateWorldState( + goQuorumPrivateStorage, goQuorumWorldStateArchive, header.getStateRoot(), header.getHash()); } public static MutableWorldState getPrivateWorldState( final GoQuorumPrivateStorage goQuorumPrivateStorage, final WorldStateArchive goQuorumWorldStateArchive, - final BlockHeader header) { - final Hash worldStateRootHash = header.getStateRoot(); - final Hash publicBlockHash = header.getHash(); + final Hash worldStateRootHash, + final Hash publicBlockHash) { final Hash privateStateRootHash = goQuorumPrivateStorage .getPrivateStateRootHash(worldStateRootHash)